用css 给tbody加垂直滚动条 - html/css语言栏目:ht

思路就是

1,把tbody设置成display:block,然后就对其高度设置一个固定值,overflow设置成auto。

2,把thead的tr设置成display:block。

3,因为都设置成block所以要给td手动添加宽度 width:200px


代码如下:

 
 
Id Name Category MonthAmount hasBackUp score
23 South Bearing Glass/Material 1234444 TRUE 3456.00
23 South Bearing Glass/Material 1234444 TRUE 3456.00
23 South Bearing Glass/Material 1234444 TRUE 3456.00
23 South Bearing Glass/Material 1234444 TRUE 3456.00
23 South Bearing Glass/Material 1234444 TRUE 3456.00
23 South Bearing Glass/Material 1234444 TRUE 3456.00
23 South Bearing Glass/Material 1234444 TRUE 3456.00
23 South Bearing Glass/Material 1234444 TRUE 3456.00
23 South Bearing Glass/Material 1234444 TRUE 3456.00
23 South Bearing Glass/Material 1234444 TRUE 3456.00
23 South Bearing Glass/Material 1234444 TRUE 3456.00

css

.table thead tr {
	display:block;
}
.table tbody {
	display: block;
	height: 200px;
	overflow: auto;
}
.table th {
	width:20%;
}
 .table td {
    width:20%;
 }


返回顶部
跳到底部

Copyright 2011-2024 南京追名网络科技有限公司 苏ICP备2023031119号-6 乌徒帮 All Rights Reserved Powered by Z-BlogPHP Theme By open开发

请先 登录 再评论,若不是会员请先 注册