【问题标题】:IE7 don't understand floating width?IE7 不理解浮动宽度?
【发布时间】:2012-09-07 15:41:11
【问题描述】:

我不知道怎么解释,在IE7中,当Right的DIV向右浮动并取消设置它的宽度时,浮动的左子DIV将与它的父DIV一样宽。

http://jsfiddle.net/dyvar/1/

IE 7

【问题讨论】:

  • 如果可能的话 - 将 width 属性添加到类为 right 的浮动父级。它将帮助布局在所有浏览器中看起来都一样。像这样:jsfiddle.net/dyvar/8

标签: css css-float


【解决方案1】:

请试试这个 http://jsfiddle.net/dyvar/2/

<div class="right fr">
        <div class="fl">D1</div>
        <div class="fl">D2</div>
    </div>

我已经更新了你的 html

上一个html

<div class="right fr">
            <div class="fl">D1</div>
            <div class="fr">D2</div>
        </div>

【讨论】:

  • 我也更新了以前的html。浮动就在那里
  • 你必须改进代码,否则你怎么能达到你的目标。你的 html 是错误的,所以我以正确的方式做了。类是错误的
  • @SACHIN 通过“出了什么问题”我的意思是问为什么它不起作用。 :-)
  • ahhh..actully
    D2
    是 float:right 而父 div 已经是 float:right 所以这是冲突。
  • @SACHIN 谢谢,你不会在其他浏览器中发生冲突吗??
猜你喜欢
  • 2023-03-08
  • 2012-03-03
  • 1970-01-01
  • 2012-12-10
  • 2011-03-22
  • 2011-11-08
  • 1970-01-01
  • 2014-06-09
  • 1970-01-01
相关资源
最近更新 更多