a.先来看看w3c 文档对于外边距折叠的定义:
In CSS, the adjoining margins of two or more boxes (which might or might not be siblings) can combine to form a single margin. Margins that combine this way are said to collapse, and the resulting combined margin is called a collapsed margin.
翻译一下:在Css中,相邻盒子(有可能是同辈元素,也可能不是)的外边距可以合并成为一个外边距。 外边距的这种合并方式称为 折叠 ,这种合并过的外边距称为 外边距折叠 。
举个例子:
.testBFC{ width:100px; height:100px; background-color:green;}.testBFC div{ width:30px; height:30px; background-color:pink; }.testBFC div:first-child{ margin-bottom:10px;}.testBFC div:last-child{ margin-top:10px;}
div1
查看更多关于Css外边距折叠(collapsedmargin)浅析_html/css_WEB-ITnose的详细内容...
声明:本文来自网络,不代表【好得很程序员自学网】立场,转载请注明出处:http://haodehen.cn/did108285