为什么我在显示时有一个 div 样式: block ; float :对,在 IE6 中,div 仍然位于文本下方,而不是在文本中间,只是向右浮动。它适用于所有其他浏览器,包括 IE7+。我需要显示 block ,因为如果我确实显示内联,那么 div 内的菜单就会一团糟。
.内容{ 显示: block ;
. float { 宽度:150px; 显示: block ; float :对; }
.没有{ 显示:内联;
float 类不在 nothing 类的右边,它在 IE6 下,知道修复方法吗?
我假设这就是意思:
<span>This is some text </span>
<div style="float: right;">
This is floated text
</div>
输出是这样的:
This is some text This is floated text
If you float the span left, or
<span style="float:left;">This is some text </span>
<div style="float: right;">
This is floated text
</div>
切换文字和 float 的顺序
<div style="float: right;">
This is floated text
</div>
<span>This is some text </span>
它正常工作:
This is some text This is floated text
最佳答案
点击 Greg 在评论 (doctype.com/wierd-ie6-float-issue) 中发布的链接以获得可行的解决方案。基本上将 float 元素放在 html 中的第一位。
关于html - CSS IE6 向右浮动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2047082/