2
我有正確的div與動態高度和30%的寬度。 目標是讓紫色元素在右div上浮動,並在結束後留下剩餘空間。有沒有可能只用CSS做到這一點?拉伸div在浮動另一個div後
.container {
height: 500px;
width:100%;
}
.yellow {
width: 30%;
background: yellow;
float: right;
margin: 5px;
}
.purple {
background:purple;
height: 40px;
margin: 5px;
width:100%;
float:left;
}
<html>
<div class="container">
<div class="yellow"> some content here <br/><br/><br/> some content here </div>
<div class="purple"> </div>
<div class="purple"> </div>
<div class="purple"> </div>
<div class="purple"> </div>
</div>
</html>