html漂亮的列表表头,html列表表头锁定,列表高度可根据浏览器高度计算

首先看html

序号内容

1我只是用来测试的
2我只是用来测试的
3我只是用来测试的
4我只是用来测试的
5我只是用来测试的
6我只是用来测试的
7我只是用来测试的
8我只是用来测试的
9我只是用来测试的
10我只是用来测试的
11我只是用来测试的
12我只是用来测试的
13我只是用来测试的
14我只是用来测试的
15我只是用来测试的

css如下

.table-head{padding-right:11px;padding-top:14px;padding-bottom:5px;}

.table-body{width:100%; height:800px;overflow-y:scroll;}

.table-head table,.table-body table{width:100%;}

.table-body table tr:nth-child(2n+1){}

.table-body table tr:hover{}

js如下

autodivheight();

function autodivheight(){ //函数:获取尺寸

//获取浏览器窗口高度

var winHeight=0;

if (window.innerHeight)

winHeight = window.innerHeight;

else if ((document.body) && (document.body.clientHeight))

winHeight = document.body.clientHeight;

//通过深入Document内部对body进行检测,获取浏览器窗口高度

if (document.documentElement && document.documentElement.clientHeight)

winHeight = document.documentElement.clientHeight;

//DIV高度为浏览器窗口的高度

var btHeight1 = document.getElementById("btid1").offsetHeight;//表头高度

document.getElementById("gdid").style.height= winHeight-btHeight1-15 +"px";

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值