【发布时间】:2011-01-04 01:28:46
【问题描述】:
当我有一个 div 样式显示时怎么会:block;浮动:对,在 IE6 中,div 仍然在文本下方,而不是在它的中间,只是向右浮动。它适用于所有其他浏览器,包括 IE7+。我需要有显示块,因为如果我确实显示内联,那么 div 内的菜单就会一团糟。
.内容{ 显示:块; }
.float { 宽度:150px; 显示:块; 浮动:对; }
.无{ 显示:内联; }
float 类不在nothing 类的右边,它在IE6 下,知道解决办法吗?
我假设这就是意思:
<span>This is some text </span>
<div style="float: right;">
This is floated text
</div>
输出是这样的:
这是一些文字
这是浮动文本
如果将跨度向左浮动,或者
<span style="float:left;">This is some text </span>
<div style="float: right;">
This is floated text
</div>
切换文字顺序并浮动
<div style="float: right;">
This is floated text
</div>
<span>This is some text </span>
正常工作:
这是一些文本 这是浮动文本
【问题讨论】:
-
也许您可以包含一些 HTML 并接受您以前的答案。
-
也许这属于 doctype.com?
-
在 doctype 上已经有类似问题:doctype.com/wierd-ie6-float-issue
标签: html internet-explorer-6 css-float inline