/margin塌陷-父子嵌套、垂直方向的margin取最大值/
.wrapper{
width: 100px;
height: 100px;
margin-left:100px;
margin-top: 100px;
/border: 1px solid black;/
background-color: green;
}
.content{
width: 50px;
height: 50px;
margin-left: 50px;
margin-top: 50px;
/margin-top: 150px;/
background-color: red;
}
bfc-block format context块级格式化上下文-解决margin塌陷
如何触发一个盒子的bfc
position:absolute;
display:inline-block;
float:left/right;
overflow:hidden;
解决方法1
.wrapper{
width: 100px;
height: 100px;
margin-left:100px;
margin-top: 100px;
/border: 1px solid black;/
overflow: hidden;
background-color: green;
}
.content{
width: 50px;
height: 50px;
margin-left: 50px;
margin-top: 50px;
/margin-top: 150px;/
background-color: red;
}