<div class="big">
<div class="child1"></div>
<div class="child2"></div>
</div>
.big {
width: 100%;
height: 200px;
background: yellow;
}
.child1 {
width: 30%;
height: 100%;
background: green;
display: inline-block;
}
.child2 {
width: 70%;
height: 100%;
background: blue;
display: inline-block;
}
效果如圖
沒在一行,並且中間有條縫。
原因:兩個div之間有空格
解決:給最外層div添加:{font-size:0}