表格中的固定标题和html角度表格中的可滚动正文 [英] fixed header and scrollable body in table in html angular

查看:70
本文介绍了表格中的固定标题和html角度表格中的可滚动正文的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Angular中,我有一张桌子,它应该是可滚动的.但是标题应该是固定的.但是虽然滚动标题不是固定的.请帮助

In Angular i have a table and it should be scrollable. But header should be fixed. but while scrolling header is not fixed. please help

推荐答案

好吧,需求似乎是您想要一个可滚动的表主体.不知道在这种情况下,角度是否会使事情有所不同. 可以肯定的是,如果可以的话,请参见 https://jsfiddle.net/hh6etg6s/上的小提琴目的.

Well, the requirement seems to be you want a scrollable table body. Not sure if angular could makes things different anyhow in this case. Just to be sure, please see the fiddle at https://jsfiddle.net/hh6etg6s/ if this serves the purpose.

.tablediv {
  padding:20px;
}
table ,tr td{
    border:1px solid red
}
tbody {
    display:block;
    height:200px;
    overflow:auto;
}
thead, tbody tr {
    display:table;
    width:100%;
    table-layout:fixed;/* even columns width , fix width of table too*/
}
thead {
    width: calc( 100% - 1em )/* scrollbar is average 1em/16px width, remove it from thead width */
}
table {
    width:400px;
}

这篇关于表格中的固定标题和html角度表格中的可滚动正文的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆