2
有沒有一種方法使div與CSS的兄弟高度相同,還是隻能用javascript實現?僅使用CSS均衡同級高度?
在這個例子中,我有一個包裝div的兩個div,我希望左邊的那個與右邊的大小相同。
代碼如下。
#wrapper {width: 50%; height; 200px;}
#box1 {background: red;}
#box2 {background: blue; height: 100px;}
.box {float: left; color: white; width: 50%;}
<div id="wrapper">
<div class="box" id="box1">Box 1</div>
<div class="box" id="box2">Box 2</div>
</div>
感謝Kukkuz,這是一個令人擔憂的簡單答案:) –