基础 页面结构
三层div,宽度与高度、padding、margin
<div id="top">
<div id="top-container">
<div class="top-item"></div>
<div class="top-item"></div>
<div class="top-item"></div>
</div>
</div>
#top {
height: 100px;
background-color: rgb(137, 211, 253);
}
#top-container {
padding: 5px;
max-width: 100%;
height: 90%; /* 这个写max- 会为空 */
}
.top-item {
width: 32.8%;
height: 100%;
border: 1px solid snow;
background-color: springgreen;
display: inline-block;
}
父盒子中均匀容纳三个子盒子,写了两种方法 ```css
top-container {
width: 100%; 一个固定值 height: 90%; 一个固定值 / display: table; /
/ display: flex; /
} .top-item { height: 100%; border: 1px solid snow; background-color: springgreen;
/* display: table-cell; 可以 */
/* flex: 1; 可以 */
} ```