如下面所示,child的margin-top传递到了parent上,这是为何?这应该是跟垂直margin的合并机制有关,这种父子之间的合并的规则是怎样的?demo
demo
#parent{background:red;width:200px;height:200px;}#child{background:green;width:50px;height:50px;margin-top:50px;}
background:red;width:200px;height:200px;}#child{background:green;width:50px;height:50px;margin-top:50px;}
width:200px;height:200px;}#child{background:green;width:50px;height:50px;margin-top:50px;}
height:200px;}#child{background:green;width:50px;height:50px;margin-top:50px;}
}#child{background:green;width:50px;height:50px;margin-top:50px;}
#child{background:green;width:50px;height:50px;margin-top:50px;}
background:green;width:50px;height:50px;margin-top:50px;}
width:50px;height:50px;margin-top:50px;}
height:50px;margin-top:50px;}
margin-top:50px;}
}
达令说
相关分类