css - 如何将滚动添加到 django 渲染表?

标签 css django html html-table

这是表格。当我给 height:500px 它修改每一行的高度而不是表格的高度,如果我将 overflow-y:scroll 添加到 tabletbody 它不起作用。行数取决于 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/

相关文章:

html - 从父表内的表中的最后一个单元格中删除 border-left

javascript - 如何使 Plotly 绘图遵循父容器的大小?

javascript - 如何像 facebook 和 twitter 一样显示帖子更新时间?

javascript - 如何检查Google表单是否已提交?

html - 将鼠标悬停在特定元素图像上时尝试显示描述文本

html - 流体布局问题

html - 是否可以在水平布局的无序列表元素中包含 block 元素

python - 制作一个元素列出 "Groupe"表的一个属性,其中元素是 "Etudiant"表的记录(元组)

Django View : get_context_data() vs get()

python - 如何在Python中截取stdout的内容?