如何使表格可滚动 [英] How do I make a table scrollable
本文介绍了如何使表格可滚动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有人知道仅使用html和css使表格主体可滚动的一种有效方法吗?
Does anyone know a vanilla way of making the body of a table scrollable using only html and css?
显而易见的解决方案
tbody {
height: 200px;
overflow-y: scroll;
}
不起作用.
这显然是表的使用吗?
我做错什么了吗?
推荐答案
您需要先声明一个高度,否则您的表将根据其内容扩展到.
You need to declare a height first, else your table will expand to the according with of it's content.
table{
overflow-y:scroll;
height:100px;
display:block;
}
在澄清了您的问题之后,我编辑了小提琴:查看此示例或
after clarifying your problem i edited the fiddle: check out this Example or that way. It's rather hacky and not quaranteed to work crossbrowser but might work for your case.
这篇关于如何使表格可滚动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文