css盒子模型

 css盒子模型

.father{
    width:300px;
    height:300px;
     background-color:red;
     margin-top:100px
}
.son{
     width:200px;
    height:200px;
     background-color:green;
     margin-top:20px
}      
此时距离上面是100px; 若要解决给父元素添加overflow:hidden;

.father{
    width:300px;
    height:300px;
     background-color:red;
     margin-top:0px
}
.son{
     width:200px;
    height:200px;
     background-color:green;
     margin-top:20px
}      
此时father距离上面是20px;  若要解决可给父元素添加overflow:hidden;

 css盒子模型

css盒子模型

以内部盒子的宽高为准

css盒子模型

css盒子模型

 css盒子模型

 默认是content-box

box-shadow