Html中 表单title头固定的CSS实现,类似于Excel中窗口冻结的功能

Html中 表单title头固定的CSS实现,类似于Excel中窗口冻结的功能,能很好的增强易用性

 

<style type="text/css">
<!--
.fixTop {
	Z-Index:102;
	position:relative;
	Top:expression(this.offsetParent.scrollTop);
}

.fixLeft {
	Z-Index:101;
	position:relative;
	left:expression(document.getElementById('scrollDiv').scrollLeft);
	background-color:#eeeeee;
}
-->
</style>

仅适用于IE:
<div id="scrollDiv" style="height: 200px; width:400px; overflow: auto;">
<table border=1 cellspacing="0" cellpadding="2">
    <tr class="fixTop" bgcolor="#eeeeee">
        <th class="fixLeft">
            LeftTop
        </th>
		<th colspan="9" align=left>
			Top
		</th>
    </tr>    
   <tr height="50">
	   <td  class="fixLeft">Left</td>
	   <td>abcdefg</td>
	   <td>abcdefg</td>
	   <td>abcdefg</td>
	   <td>abcdefg</td>
	   <td>abcdefg</td>
	   <td>abcdefg</td>
	   <td>abcdefg</td>
	   <td>abcdefg</td>
	   <td>abcdefg</td>
   </tr>
   <tr height="50">
	   <td  class="fixLeft">Left</td>
	   <td>abcdefg</td>
	   <td>abcdefg</td>
	   <td>abcdefg</td>
	   <td>abcdefg</td>
	   <td>abcdefg</td>
	   <td>abcdefg</td>
	   <td>abcdefg</td>
	   <td>abcdefg</td>
	   <td>abcdefg</td>
   </tr>

   <tr height="50">
	   <td  class="fixLeft">Left</td>
	   <td>abcdefg</td>
	   <td>abcdefg</td>
	   <td>abcdefg</td>
	   <td>abcdefg</td>
	   <td>abcdefg</td>
	   <td>abcdefg</td>
	   <td>abcdefg</td>
	   <td>abcdefg</td>
	   <td>abcdefg</td>
   </tr>

   <tr>
	   <td  class="fixLeft">Left</td>
	   <td>abcdefg</td>
	   <td>abcdefg</td>
	   <td>abcdefg</td>
	   <td>abcdefg</td>
	   <td>abcdefg</td>
	   <td>abcdefg</td>
	   <td>abcdefg</td>
	   <td>abcdefg</td>
	   <td>abcdefg</td>
   </tr>

   <tr>
	   <td  class="fixLeft">Left</td>
	   <td>abcdefg</td>
	   <td>abcdefg</td>
	   <td>abcdefg</td>
	   <td>abcdefg</td>
	   <td>abcdefg</td>
	   <td>abcdefg</td>
	   <td>abcdefg</td>
	   <td>abcdefg</td>
	   <td>abcdefg</td>
   </tr>

   <tr>
	   <td  class="fixLeft">Left</td>
	   <td>abcdefg</td>
	   <td>abcdefg</td>
	   <td>abcdefg</td>
	   <td>abcdefg</td>
	   <td>abcdefg</td>
	   <td>abcdefg</td>
	   <td>abcdefg</td>
	   <td>abcdefg</td>
	   <td>abcdefg</td>
   </tr>

</table>
</div>

 

你可能感兴趣的:(html,css,Excel,IE)