我想要div
与display: table-cell
设置百分比宽度。 display: table-cell
是我最好的选择,我需要并肩div
s是平等的高度。即使使用表格固定,CSS表格单元格也会忽略宽度
经过研究,我正确地将父母设置为display: table; table-layout: fixed; width: 100%
,如在许多other threads中找到的,但table-cell
仍填充父母。
.table-wrapper {
display: table;
table-layout: fixed;
width: 100%;
}
.table-cell {
display: table-cell;
width: 25%;
overflow: hidden !important;
border: 1px solid black;
}
<div class="table-wrapper">
<div class="table-cell">
Should be 25%, but it fills .table-wrapper
</div>
</div>
这是不可能的?