实现在一个TABLE表中,保持表头不动,固定表头

前端之家收集整理的这篇文章主要介绍了实现在一个TABLE表中,保持表头不动,固定表头前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
<html>
<head>
<title></title>
<style>
//此式样将第一行一直保留在页面上,不随滚动条的移动而移动
.Freezing_tdd
{
top:expression(document.getElementById('div-1').scrollTop-1);
position:relative ;
}
</style>
</head>
<body>
<div id="div-1" style="width:50%;height:30%;overflow:auto">
<table border="1" cellspacing="1" cellpadding=0 id="scroll" style="table-layout:fixed;">
<tr align="left" class="Freezing_tdd" valign="middle" bgcolor="#C4E0FF" height="23" id="titleD">
<td width="100" >&nbsp;序号</td>
<td width="500" height="23" >&nbsp;企业名称</td>
<td width="80" height="23" >&nbsp;联系人</td>
<td width="120" height="23">&nbsp;联系电话</td>
</tr>
<tr align="left" valign="middle" height="23">
<td height="23" >&nbsp;序号</td>
<td height="23" >&nbsp;企业名称</td>
<td height="23">&nbsp;联系人</td>
<td height="23">&nbsp;联系电话</td>
</tr>
<tr align="left" valign="middle" height="23">
<td height="23" >&nbsp;序号</td>
<td height="23" >&nbsp;企业名称</td>
<td height="23">&nbsp;联系人</td>
<td height="23">&nbsp;联系电话</td>
</tr>
<tr align="left" valign="middle" height="23">
<td height="23" >&nbsp;序号</td>
<td height="23" >&nbsp;企业名称</td>
<td height="23">&nbsp;联系人</td>
<td height="23">&nbsp;联系电话</td>
</tr>
<tr align="left" valign="middle" height="23">
<td height="23" >&nbsp;序号</td>
<td height="23" >&nbsp;企业名称</td>
<td height="23">&nbsp;联系人</td>
<td height="23">&nbsp;联系电话</td>
</tr>
<tr align="left" valign="middle" height="23">
<td height="23" >&nbsp;序号</td>
<td height="23" >&nbsp;企业名称</td>
<td height="23">&nbsp;联系人</td>
<td height="23">&nbsp;联系电话</td>
</tr>
<tr align="left" valign="middle" height="23">
<td height="23" >&nbsp;序号</td>
<td height="23" >&nbsp;企业名称</td>
<td height="23">&nbsp;联系人</td>
<td height="23">&nbsp;联系电话</td>
</tr>
<tr align="left" valign="middle" height="23">
<td height="23" >&nbsp;序号</td>
<td height="23" >&nbsp;企业名称</td>
<td height="23">&nbsp;联系人</td>
<td height="23">&nbsp;联系电话</td>
</tr>
<tr align="left" valign="middle" height="23">
<td height="23" >&nbsp;序号</td>
<td height="23" >&nbsp;企业名称</td>
<td height="23">&nbsp;联系人</td>
<td height="23">&nbsp;联系电话</td>
</tr>
<tr align="left" valign="middle" height="23">
<td height="23" >&nbsp;序号</td>
<td height="23" >&nbsp;企业名称</td>
<td height="23">&nbsp;联系人</td>
<td height="23">&nbsp;联系电话</td>
</tr>
<tr align="left" valign="middle" height="23">
<td height="23" >&nbsp;序号</td>
<td height="23" >&nbsp;企业名称</td>
<td height="23">&nbsp;联系人</td>
<td height="23">&nbsp;联系电话</td>
</tr>
<tr align="left" valign="middle" height="23">
<td height="23" >&nbsp;序号</td>
<td height="23" >&nbsp;企业名称</td>
<td height="23">&nbsp;联系人</td>
<td height="23">&nbsp;联系电话</td>
</tr>
<tr align="left" valign="middle" height="23">
<td height="23" >&nbsp;序号</td>
<td height="23" >&nbsp;企业名称</td>
<td height="23">&nbsp;联系人</td>
<td height="23">&nbsp;联系电话</td>
</tr>
<tr align="left" valign="middle" height="23">
<td height="23" >&nbsp;序号</td>
<td height="23" >&nbsp;企业名称</td>
<td height="23">&nbsp;联系人</td>
<td height="23">&nbsp;联系电话</td>
</tr>
<tr align="left" valign="middle" height="23">
<td height="23" >&nbsp;序号</td>
<td height="23" >&nbsp;企业名称</td>
<td height="23">&nbsp;联系人</td>
<td height="23">&nbsp;联系电话</td>
</tr>
<tr align="left" valign="middle" height="23">
<td height="23" >&nbsp;序号</td>
<td height="23" >&nbsp;企业名称</td>
<td height="23">&nbsp;联系人</td>
<td height="23">&nbsp;联系电话</td>
</tr>
<tr align="left" valign="middle" height="23">
<td height="23" >&nbsp;序号</td>
<td height="23" >&nbsp;企业名称</td>
<td height="23">&nbsp;联系人</td>
<td height="23">&nbsp;联系电话</td>
</tr>
<tr align="left" valign="middle" height="23">
<td height="23" >&nbsp;序号</td>
<td height="23" >&nbsp;企业名称</td>
<td height="23">&nbsp;联系人</td>
<td height="23">&nbsp;联系电话</td>
</tr>
<tr align="left" valign="middle" height="23">
<td height="23" >&nbsp;序号</td>
<td height="23" >&nbsp;企业名称</td>
<td height="23">&nbsp;联系人</td>
<td height="23">&nbsp;联系电话</td>
</tr>
<tr align="left" valign="middle" height="23">
<td height="23" >&nbsp;序号</td>
<td height="23" >&nbsp;企业名称</td>
<td height="23">&nbsp;联系人</td>
<td height="23">&nbsp;联系电话</td>
</tr>
<tr align="left" valign="middle" height="23">
<td height="23" >&nbsp;序号</td>
<td height="23" >&nbsp;企业名称</td>
<td height="23">&nbsp;联系人</td>
<td height="23">&nbsp;联系电话</td>
</tr>
<tr align="left" valign="middle" height="23">
<td height="23" >&nbsp;序号</td>
<td height="23" >&nbsp;企业名称</td>
<td height="23">&nbsp;联系人</td>
<td height="23">&nbsp;联系电话</td>
</tr>
<tr align="left" valign="middle" height="23">
<td height="23" >&nbsp;序号</td>
<td height="23" >&nbsp;企业名称</td>
<td height="23">&nbsp;联系人</td>
<td height="23">&nbsp;联系电话</td>
</tr>
<tr align="left" valign="middle" height="23">
<td height="23" >&nbsp;序号</td>
<td height="23" >&nbsp;企业名称</td>
<td height="23">&nbsp;联系人</td>
<td height="23">&nbsp;联系电话</td>
</tr>
<tr align="left" valign="middle" height="23">
<td height="23" >&nbsp;序号</td>
<td height="23" >&nbsp;企业名称</td>
<td height="23">&nbsp;联系人</td>
<td height="23">&nbsp;联系电话</td>
</tr>
<tr align="left" valign="middle" height="23">
<td height="23" >&nbsp;序号</td>
<td height="23" >&nbsp;企业名称</td>
<td height="23">&nbsp;联系人</td>
<td height="23">&nbsp;联系电话</td>
</tr>
<tr align="left" valign="middle" height="23">
<td height="23" >&nbsp;序号</td>
<td height="23" >&nbsp;企业名称</td>
<td height="23">&nbsp;联系人</td>
<td height="23">&nbsp;联系电话</td>
</tr>
<tr align="left" valign="middle" height="23">
<td height="23" >&nbsp;序号</td>
<td height="23" >&nbsp;企业名称</td>
<td height="23">&nbsp;联系人</td>
<td height="23">&nbsp;联系电话</td>
</tr>
</table>
</div>
<font color="red">PS:将table放入一个指定大小的div中,固定Table表头,将表格第一行Tr中加入css:Freezing_tdd</font> </body> </html>
原文链接:https://www.f2er.com/javaschema/287747.html

猜你在找的设计模式相关文章