设计要求表头固定表身滚动,按照网上的方案css是这样写的,表外包裹一个class="table-responsive"的div
thead,tbody tr{
display:table;
width:100%;
table-layout: fixed;
}
tbody{
display:block;
height:280px;
overflow-y: scroll;
}
这在pc端完全没问题,但是模拟移动端尺寸大小时,需要效果为tbody超280时竖向滚动,整个table超屏幕宽度横向滚动。
上述css放在移动端发现表头都紧凑的挤在一起,对字长的th简直就是灾难!然后我改成了如下css,内容是舒展开了但还是存在错位问题:
thead{
width:auto;
}
tbody tr{
width:100%;
}
thead,tbody tr{
table-layout: fixed;
display:table;
}
tbody{
display:block;
height:280px;
overflow-y: scroll;
}
求解决方法