我是html新手,请耐心等待。
我正在尝试将 4 个 div 平行对齐,其中第一个、第三个和第四个 div 是静态的,第二个 div 是空的,我需要它占据剩余的位置,例如“宽度:自动”。我不想用表来解决问题。有没有办法使用div来解决它?
HTML:
<div class="container">
<div class="content" >
first
</div>
<div class="empty">
</div>
<div class="content">
third
</div>
<div class="content">
fourth
</div>
</div>
CSS:
.container{
strong textwidth:1020px;
height:40px;
}
.content{
position:relative;
background-color:#2cc2e7;
height:40px;
width:142px;
float:right;
margin-right:5px;
}
.empty{
background-color:#f1d486;
height:40px;
width:auto;
margin-right:5px;
}