扫码关注官方订阅号
http://jsfiddle.net/gothic/B6E8F
不是说两个或多个毗邻的普通流中的块元素垂直方向上的 margin 会折叠,那么这个例子违反了哪个条件?
w3.org关于margin合并的规范说明
Two margins are adjoining if and only if: both belong to in-flow block-level boxes that participate in the same block formatting context no line boxes, no clearance, no padding and no border separate them ...
Two margins are adjoining if and only if:
both belong to in-flow block-level boxes that participate in the same block formatting context
no line boxes, no clearance, no padding and no border separate them
...
margin要从属于相同的BFC中的块级盒子,overflow: hidden 创建了一个新的 BFC,所以自然就不会折叠了。
overflow: hidden
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
w3.org关于margin合并的规范说明
margin要从属于相同的BFC中的块级盒子,
overflow: hidden
创建了一个新的 BFC,所以自然就不会折叠了。