这是表格。当我给 height:500px
它修改每一行的高度而不是表格的高度,如果我将 overflow-y:scroll
添加到 table
,tbody
它不起作用。行数取决于 frame_list 中存在多少帧。
如何为这个表格添加滚动条?
<table id="telemetry_table1">
<thead>
<tr>
<th>Frame identifier</th>
<th>Frame Arriving Date</th>
<th>Frame Arriving Time</th>
</tr>
</thead>
<tbody>
{% for frame in frame_list %}
<tr>
<td>{{frame.frame_identifier_type}}</td>
<td>{{frame.frame_arriving_time}}</td>
<td>{{frame.frame_arriving_date}}</td>
</tr>
{% endfor %}
</tbody>
</table>
最佳答案
尝试将此添加到您的 css
#telemetry_table1 {
position:relative;
overflow:auto;
}
关于css - 如何将滚动添加到 django 渲染表?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31023959/