所以我有一个div内的三个div。让子div扩展为填充父div的宽度
<div class="parent">
<div class="child> Text</div>
<div class="child">Text</div>
<div class="child">Text</div>
</div>
我想让孩子的div填满家长的宽度(孩子的总宽度应该是父母)。但是,这并没有发生,我倒下了。我认为这是因为孩子divs根据他们的内容设置宽度。
我该如何实现我想要的?
CSS-
.child {
background: white;
color: #a7a9ac;
cursor: pointer;
font-size: 15px;
border-right: 1px;
border-top: 0;
border-bottom: 0;
border-left: 0;
border-style: solid;
border-color: @faded-grey;
padding-right: 10px;
margin: 0 auto;
height: 100%;
}
.parent {
border-top: 1px;
border-left: 0;
border-bottom: 1;
border-style: solid;
border-color: @faded-grey;
border-right: 0;
width: 100%;
margin-right: 0px;
height: 80px;
}
你可以发布你正在使用的CSS? – cr0atIAN
有很多方法,但这取决于你想要什么。在内容确定宽度后,是否希望_last_子div填充剩余空间?或者你想让它们均匀分布,_i.e._通过'width:33%'? –
设置CSS,尝试宽度:33%,但它将div放在另一个上面 – praks5432