html - CSS IE6 向右浮动

标签 html internet-explorer-6 css-float inline

为什么我在显示时有一个 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/

相关文章:

javascript - 嵌入谷歌地图只显示左上角

css - 如何在 IE7 和 IE6 中垂直居中元素?

css - 如何在 drupal 6 中为 IE 浏览器使用条件 CSS?

html - CSS 'float: right;' 问题

html - 是否 float :left make many <div>s/<p>s stay in a single line?

javascript - jquery幻灯片效果,隐藏一个div并显示另一个

javascript - 该按钮未调用 javascript 函数

html - sql中如何获取奇数节点和偶数节点的值

css - IE6和IE7菜单显示:block with padding isn't allowing complete selection

html - 获取带 float 的电子菜单