问题描述
说我有以下代码
<style type="text/css" media="all">
span, ul, ul li {
display: inline-block;
vertical-align: top;
margin: 0;
padding: 0;
list-style: none;
}
</style>
<span>i would want</span>
<ul>
<li>this</li>
<li>on</li>
<li>one line.</li>
</ul>
我想要在IE8中内嵌显示。在任何地方,我已经阅读一切都说这应该工作,IE8支持inline-block。但是一天上午之后,我不能得到上面的排队。我知道我可以浮动,但与我的页面上的其他元素(这里未显示),我需要使用一个'clearfix'这是更加标记。我只需要目标IE8,并希望知道为什么内联块不为我工作,当显然它的支持。
I want this to display inline in IE8. Everywhere I have read everything says this should work, IE8 supports inline-block. However after a morning of trying I cant get the above to line up. I know I could float it, but with the other elements on my page (not shown here) I would need to use a 'clearfix' which is more mark up. I only need to target IE8 and would love to know why inline block doesn't work for me when apparently its supported. The above code does what I want when viewed in Google Chrome.
推荐答案
我猜你还没有声明一个doctype。尝试将它放在第一行的html标签之前:
I'm guessing you haven't declared a doctype. Try placing this on the first line, before the html tag:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
您粘贴的代码在IE8中与该doctype一起工作。
The code you pasted works in IE8 with that doctype.
这篇关于IE8显示内联块不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!