撑开盒子的情况
.father {
width: 300px;
height: 300px;
background-color: orange;
padding-left: 100px; 因为盒子宽度给定,padding会撑开盒子
}
.son {
background-color: green;
}
123
没撑开盒子情况
.father {
width: 300px;
height: 300px;
background-color: orange;
}
.son {
background-color: green;
padding-left: 100px; //没有宽度,使用默认,盒子不会撑开
}
123
撑开盒子情况
.father {
width: 300px;
height: 300px;
background-color: orange;
}
.son {
width: 300px;
background-color: green;
padding-left: 100px;
}
123