如何让Div中并列的几个子元素充分平均地填满所有空间?
RT.
我还是贴一下我要应用的地方吧
<div class="btn-group btn-mul maxln">
<button type="button" class="btn" style="width:20%;">Left</button>
<button type="button" class="btn">Middle</button>
<button type="button" class="btn">Right</button>
<button type="button" class="btn">Right</button>
</div>
你的乃頭有毒
10 years, 11 months ago
Answers
没人回答,我自己倒是找到了一个不完美方法
div.row3 *{
width:33.3%;
}
div.row4 *{
width:25%;
}
div.row5 *{
width:20%;
}
以此类推
以前尝试着写过一段js但是失败了不知道问题在哪 在外层元素加fito class在内层加fiti class
$.each($('.fito'),
function(ord,ele){
var fitolen = parseInt(ele.css('width'));
var fitilen = fitolen / ele.children($('.fiti')).length;
$.each(ele.children('.fiti'),
function(ordi,elei){
elei.css('width') = fitilen;
})
})
大灰狼
answered 10 years, 11 months ago