css - IE6 float

标签 css internet-explorer-6

我似乎对 IE6 有点问题,通常我会放弃对 IE6 的支持,但我正在从事的元素有可能会有很多人使用 IE6 访问该站点。 如果您有 IE6 并且想检查问题,请使用我的主页链接。

基本上 div#content 低于 div#left。 我试过 Robert Nyman方法,但那没有用。 任何人都知道任何其他方法吗?

<html>
<style type="text/css">
#wrapper{ width:980px; margin:auto; background-color:#fff }
#header{ width:980px; position:relative }
#middle{ width: 980px; padding:20px; overflow:hidden; clear:both }
#left{ float:left; width:200px }
#main{ width:740px; margin: 0px 0px 0px 210px }
#content { width: 480px; min-height: 400px; float:left }
#right{ float:left; width:240px; margin: 0px 0px 0px 10px }
#footer{ clear:both; width:980px; margin:auto; padding:20px 0 }
</style>

<body>
<div id="wrapper">
    <div id="header">

    </div>
    <div id="middle">
        <div id="left">

        </div>
        <div id="main">
            <div id="content">

            </div>
            <div id="right">

            </div>
        </div>
    </div>
</div>
<div id="footer">

</div>

最佳答案

乍一看很容易看出可能的原因(我什至没有深究问题):

1) 始终使用 DOCTYPE!没有它,您将永远无法编写跨浏览器的普通难度代码。

2) 为了制作这样的东西,请尝试更频繁地使用 float 属性!

3) 看到宽度为 980px 的 block ,我真的很惊讶;和填充:20px;应该放在 block 中:宽度:980px;包含在宽度中的填充 - 已成为过去!!

4) #right 有属性:float: left;左边距:10px; - 在这种情况下,IE6 使 margin-left = 20px - 这是一个非常著名的错误。将此属性添加到此 block :显示:内联;一切都会好的(所以,原因不在于填充,而在于边距)

不要忘记阅读标准和建议!

关于css - IE6 float ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1284345/

相关文章:

javascript - Gatsby / react : how to create clean fallback for non JS users?

javascript - 如何在html中上传图片后显示按钮?

html - 图像不响应屏幕宽度

css - Chrome Colspan 更新后无法使用

html - 在 IE6 中使用 html 和 css 水平(横向)扩展菜单

html - IE6 和 IE7 不能正确处理具有高度属性的元素的边距

png - 道德困境 : Should I still cater for IE6 as a web-developer

css - 溢出的 -webkit-paged-y 和 -webkit-paged-x 值是多少

css - 如何消除 IE6 中的意外间距?

javascript - Internet Explorer 中的鼠标坐标