我有嵌套表寬度問題的問題。我需要將表作爲響應。像以下圖片一樣。這是我的代碼DEMO嵌套表寬度問題
HTML
<div class="layout">
<div class="left">Left</div>
<div class="right">
<div class="table-responsive">
<table>
<tr>
<th>Sample Headding</th>
...
</tr>
<tr>
<td>Sample Headding</td>
...
</tr>
</table>
</div>
</div>
</div>
CSS
.layout {
width: 800px;
display: table;
}
.layout .left, .layout .right {
display: table-cell;
}
.layout .left {
width: 25%;
background: #eee;
}
.table-responsive {
width: 100%;
margin-bottom: 15;
overflow-y: hidden;
overflow-x: scroll;
-ms-overflow-style: -ms-autohiding-scrollbar;
border: 1px solid #CCC;
-webkit-overflow-scrolling: touch;
}
.table-responsive > .table > thead > tr > th,
.table-responsive > .table > thead > tr > td,
.table-responsive > .table > tbody > tr > th,
.table-responsive > .table > tbody > tr > td,
.table-responsive > .table > tfoot > tr > th,
.table-responsive > .table > tfoot > tr > td {
white-space: nowrap;
}
我在這裏沒有看到任何嵌套表格。 – Ranjith
嵌套表格表示父div是display:table。 –