gpt4 book ai didi

html - IE7 边距折叠成填充

转载 作者:太空狗 更新时间:2023-10-29 16:43:15 25 4
gpt4 key购买 nike

为什么在下面的示例中,外部 div 的填充会折叠到内部 div 的边距?

<!DOCTYPE html>
<html>
<head>
<title>Col Padding</title>
<link rel='stylesheet' type='text/css' media='all' href='http://meyerweb.com/eric/tools/css/reset/reset.css' />
<style type='text/css'>
.padding
{
padding: 50px;
background-color: green;
zoom: 1;
width: 500px;
}
.margin
{
margin: 100px;
background-color: blue;
}
</style>
</head>
<body>
<div class='padding'><div class='margin'>Content</div></div>
</body>
</html>

这是在 IE 7.0.5730.13 中
IE7 collapses the green padding
这是在 FF 6.0.2
FF and Chrome add the green padding and blue margins

@David - idk 我只有 IE7
@Faust - 我现在附上了截图。我用 XRAY 检查了它们,发现它们不同。
@veritas - 更改 DOCTYPES 似乎没有任何改变。我检查了一下,IE7 正在标准模式下呈现。

最佳答案

尝试添加 float:left

不是最好的选择,但有时可行。

关于html - IE7 边距折叠成填充,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7667579/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com