【问题标题】:CSS IE6 float rightCSS IE6 向右浮动
【发布时间】: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


【解决方案1】:

点击 Greg 在评论 (doctype.com/wierd-ie6-float-issue) 中发布的链接以获取可行的解决方案。基本上把你的浮动元素放在 html 中。

【讨论】:

    【解决方案2】:

    在您的情况下,这可能不是一个选项,但也许您可以尝试在父元素中使用 float: leftalign: right?这在过去对我有用,但并非在所有情况下都有用。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-08-13
      • 1970-01-01
      • 2014-05-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多