我正在设计一个div并在div中有一个div
<div id="header"><div id="header-top"></div></div>
“#header”具有深色背景颜色,“#header-top”具有浅色背景颜色 . “#header的边界半径也是7px .
在css中,“#header-top”有一个像这样的边距“margin:10px 0 0 10px;”因此它被向下推10px并向左推10px使其居中并且在浅色内部背景周围出现黑色边框 .
然而,似乎顶部'border'比边框更薄 . Does css make it such that 10px on top is different than 10px on the sides?
1 回答
#header-top的上边距可能会突破#header的边缘,尽管很难说肯定脱离上下文 . 见http://complexspiral.com/publications/uncollapsing-margins/