css - IE7 在同一个元素上 float 和清除

标签 css internet-explorer css-float

这是我的代码,

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>[your title]</title>
    <style type="text/css">
    .a, .b, .c
    {
        float: left;
    }
    .b
    {
        clear: left;
    }
    </style>
</head>
<body>
<div class="a">1</div>
<div class="b">2</div>
<div class="c">3</div>
</body>
</html>

在 IE8、firefox、chrome、safari、opera 中,输出将是:

1
23

但是在 IE7 中:

13
2

我已经搜索了两天的解决方案...有人可以提供帮助吗?

干杯, b长颈鹿

最佳答案

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>[your title]</title>
    <style type="text/css">
    .a, .b, .c
    {
        float: left;
    }
    .b
    {
        clear: left;
    }
    </style>
</head>
<body>
<div class="a">1</div>
<div style="clear: left;"></div>
<div class="b">2</div>
<div class="c">3</div>
</body>

关于css - IE7 在同一个元素上 float 和清除,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2467745/

相关文章:

html - 我的 CSS 弄乱了我的验证码

jquery - 如何设置导航以更改某些点的字体颜色?

jQuery 菜单 - 单击以打开但关闭其他菜单

c++ - Internet Explorer 附加组件列表

html - float div 中的列表

html - 为什么 div 不包围它的 child ?

javascript - 在我的网站上将最新的推文作为纯文本添加?

java - WebLogic 文件传输失败? java.io.IOException : failed to read '2607' bytes from InputStream

html - IE 7 在 table 上增加额外的高度

css - float 的CSS问题