如何将绿色div
width: 100%
与另外两个div
放在固定width
的同一行。
我的想法是让双方div
的宽度固定,中央div
为width: 100%
(占用剩余空间)。
是否可以实施这种情况?
.boxMenu {
width:200px;
height:40px;
background-color:#000;
float:left;
}
.boxConteudoMaster {
height:40px;
background-color:#4cff00;
float:left;
}
.boxNotificacao {
width:200px;
height:40px;
background-color:#000;
float:left;
}
<div class="boxMenu"></div>
<div class="boxConteudoMaster">asd</div>
<div class="boxNotificacao"></div>
答案 0 :(得分:1)
我认为你的事情是这样的:
<div class="boxMenu"></div>
<div class="boxNotificacao"></div>
<div class="boxConteudoMaster">Testing...</div>
.boxMenu {
width:200px;
height:40px;
background-color:#000;
float:left;
}
.boxConteudoMaster {
height:40px;
background-color:#4cff00;
width: 100%;
}
.boxNotificacao {
width:200px;
height:40px;
background-color:#000;
float:right;
}
因此,我们可以浮动我们想要修复的2 div
(float:left
和float: right
),然后在放置后div
到width: 100%
。