2 回答
TA贡献1854条经验 获得超8个赞
你可以使用弹性
如果它们是兄弟,则 Flex 项目可以共享相同的宽度。
https://developer.mozilla.org/en-US/docs/Web/CSS/flex-direction
.parent {
display: flex;
}
.container {
display: flex;
flex-direction: column;
}
<div class='parent'>
<div class="container">
<button>label label label label</button>
<button>button</button>
<button>button</button>
<button>button</button>
<button>button button</button>
</div>
</div>
TA贡献1815条经验 获得超13个赞
您可以使用 display:table 选项:
https://jsfiddle.net/falkedesign/bjxL1atd/
.table {
display: table;
}
.torw {
display: table-row;
}
.tcell {
display: table-cell;
}
div {
border: 1px solid #000;
}
button {
width: 100%;
}
<div class="table">
<div class="trow"><button>BTN</button></div>
<div class="trow"><span class="tcell">txt</span></div>
<div class="trow"><span class="tcell">txt sdf sdf</span></div>
<div class="trow"><span class="tcell">txt sdfsdfsdfsdfsd</span></div>
</div>
添加回答
举报