我在div展示桌上有3列的頁面打樣。 這裏第一個是jsfiddle https://jsfiddle.net/9mzuxza9/2/ 在左側我放置了很多行的表格,例如它的結果 當col內的內容變得高於容器並且容器擴展了他的高度,但是我希望那個容器保持在與screen no相同的高度內容。 CSS內容展開容器
html,body{
width: 100%;
height: 100%;
}
.row{
table-layout: fixed;
display: table;
height: 100%;
width: 100%;
border: 1px solid grey;
}
.left {
width:300px;
height:100%;
display: table-cell;
}
.middle {
height:100%;
display: table-cell;
width:100%;
}
.right {
height:100%;
width:300px;
display: table-cell;
}
HTML
<div class="row">
<div class="left"> Some content <table border="1">
<thead>
<tr>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
<!-- ...more rows-->
</tbody>
</table>
</div>
<div class="middle"> This should fill the space left </div>
<div class="right"> Some other content </div>
</div>
我不完全明白你的意思,但隱藏溢出的內容在容器上使用'overflow:hidden;'。要使它滾動,請使用'overflow:scroll-y;' – cdm
@cdm它似乎不適用於'display:table-cell;'OP使用 – KWeiss
並給「左」類一些固定高度。 –