Firefox 8.0.1を使用しています
margin-top
は期待どおりに機能していません。どうも。このdivマージンが期待どおりに機能しないのはなぜですか?
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>New Border</title>
<style type="text/css">
#page {
width:980px;
margin: 50px auto;
}
#board {
width:600px;
height:400px;
background-color: gray;
}
.cell {
border: 1px solid;
width:50px;
height:20px;
margin: 30px 5px;
}
</style>
</head>
<body>
<div id="page">
<div id="board">
<div class="cell">
</div>
</div>
</div>
</body>
</html>
ので、cell
divの中margin-top
は期待通りに動作していません。
divをboard
divの下に配置するには、margin-left
とする必要がありますが、そうではありません。
これはスクリーンショットです:
これはわかります。 padding-topまたはborder-topのいずれかをボード要素に追加すると、動作しますhttp://www.blog.highub.com/css/css-hacks/css-firefox-top-margin-extra-space/ – hetaoblog
これはMarginはこれをチェックします。http://www.w3.org/TR/CSS21/box.html#collapsing-margins、http://reference.sitepoint.com/css/collapsingmargins – sandeep
thx a lot!これでわかりました – hetaoblog