现在的位置: 首页 > 综合 > 正文

固定行标题和列标题

2013年04月20日 ⁄ 综合 ⁄ 共 4731字 ⁄ 字号 评论关闭

<html>
<head>
<mce:style type="text/css"><!--
body,table, td, a{
   font-size:12px;
   text-align:center;
}
/*重点:固定行头样式*/
.scrollRowThead{
     position: relative;
     left: expression(this.parentElement.parentElement.parentElement.parentElement.scrollLeft);
     z-index:0;
}
/*重点:固定表头样式*/
.scrollColThead{
     position: relative;
     top: expression(this.parentElement.parentElement.parentElement.scrollTop);
     z-index:2;
}
/*行列交叉的地方*/
.scrollCR{
     z-index:3;
}
/*div外框*/
.scrollDiv{
height:200px;
clear: both;
border: 1px solid #EEEEEE;
OVERFLOW: scroll;
width: 100%;
}
/*行头居中*/
.scrollColThead td,.scrollColThead th{
     text-align: center ;
}
/*行头列头背景*/
.scrollRowThead,.scrollColThead td,.scrollColThead th{
background-color:EEEEEE;
}
/*表格的线*/
.scrolltable{
border-bottom:1px solid #CCCCCC;
border-right:1px solid #CCCCCC;
}
/*单元格的线等*/
.scrolltable td,.scrollTable th{
     border-left: 1px solid #CCCCCC;
     border-top: 1px solid #CCCCCC;
     padding: 5px;
}
--></mce:style><style type="text/css" mce_bogus="1">body,table, td, a{
   font-size:12px;
   text-align:center;
}
/*重点:固定行头样式*/
.scrollRowThead{
     position: relative;
     left: expression(this.parentElement.parentElement.parentElement.parentElement.scrollLeft);
     z-index:0;
}
/*重点:固定表头样式*/
.scrollColThead{
     position: relative;
     top: expression(this.parentElement.parentElement.parentElement.scrollTop);
     z-index:2;
}
/*行列交叉的地方*/
.scrollCR{
     z-index:3;
}
/*div外框*/
.scrollDiv{
height:200px;
clear: both;
border: 1px solid #EEEEEE;
OVERFLOW: scroll;
width: 100%;
}
/*行头居中*/
.scrollColThead td,.scrollColThead th{
     text-align: center ;
}
/*行头列头背景*/
.scrollRowThead,.scrollColThead td,.scrollColThead th{
background-color:EEEEEE;
}
/*表格的线*/
.scrolltable{
border-bottom:1px solid #CCCCCC;
border-right:1px solid #CCCCCC;
}
/*单元格的线等*/
.scrolltable td,.scrollTable th{
     border-left: 1px solid #CCCCCC;
     border-top: 1px solid #CCCCCC;
     padding: 5px;
}</style>
</head>
<body>
<div id="scrollDiv" class="scrollDiv" >
  <table border="0" cellpadding="3" cellspacing="0" width="100%" class="scrollTable">
    <tr class="scrollColThead"  >
      <th class="scrollRowThead scrollCR"  > </th>
      <th colspan="2">列头</th>
      <th colspan="10">列头</th>
    </tr>
    <tr class="scrollColThead">
      <th class="scrollRowThead scrollCR" nowrap="nowrap" width="120">序号</th>
      <th nowrap="nowrap" width="120">媒体名称</th>
      <th nowrap="nowrap" width="120">版面</th>
      <th nowrap="nowrap" width="120">行业1</th>
      <th nowrap="nowrap" width="120">行业1</th>
      <th nowrap="nowrap" width="120">行业1</th>
      <th nowrap="nowrap" width="120">行业1</th>
      <th nowrap="nowrap" width="120">行业1</th>
      <th nowrap="nowrap" width="120">行业1</th>
      <th nowrap="nowrap" width="120">行业1</th>
      <th nowrap="nowrap" width="120">行业1</th>
      <th nowrap="nowrap" width="120">行业1</th>
      <th nowrap="nowrap" width="150">行业1</th>
    </tr>
    <tr>
      <td class="scrollRowThead"><input type="checkbox" name="checkbox" value="checkbox">a</td>
      <td>单元格2</td>
      <td>单元格3</td>
      <td>单元格4</td>
      <td>单元</td>
      <td> </td>
      <td> </td>
      <td> </td>
      <td> </td>
      <td> </td>
      <td> </td>
      <td> </td>
      <td> </td>
    </tr>
    <tr>
      <td class="scrollRowThead"><input type="checkbox" name="checkbox2" value="checkbox">b</td>
      <td>单元格2</td>
      <td>单元格3</td>
      <td>单元格4</td>
      <td>单元格5</td>
      <td> </td>
      <td> </td>
      <td> </td>
      <td> </td>
      <td> </td>
      <td> </td>
      <td> </td>
      <td> </td>
    </tr>
    <tr>
      <td class="scrollRowThead"><input type="checkbox" name="checkbox3" value="checkbox">1</td>
      <td>单元格2</td>
      <td>单元格3</td>
      <td>单元格4</td>
      <td>单元格5</td>
      <td> </td>
      <td> </td>
      <td> </td>
      <td> </td>
      <td> </td>
      <td> </td>
      <td> </td>
      <td> </td>
    </tr>
    <tr>
      <td class="scrollRowThead"><input type="checkbox" name="checkbox4" value="checkbox">2</td>
      <td>单元格2</td>
      <td>单元格3</td>
      <td>单元格4</td>
      <td>单元格5</td>
      <td> </td>
      <td> </td>
      <td> </td>
      <td> </td>
      <td> </td>
      <td> </td>
      <td> </td>
      <td> </td>
    </tr>
    <tr>
      <td class="scrollRowThead"><input type="checkbox" name="checkbox5" value="checkbox">3</td>
      <td>单元格2</td>
      <td>单元格3</td>
      <td>单元格4</td>
      <td>单元格5</td>
      <td> </td>
      <td> </td>
      <td> </td>
      <td> </td>
      <td> </td>
      <td> </td>
      <td> </td>
      <td> </td>
    </tr>
    <tr>
      <td class="scrollRowThead"><input type="checkbox" name="checkbox6" value="checkbox">4</td>
      <td>单元格2</td>
      <td>单元格3</td>
      <td>单元格4</td>
      <td>单元格5</td>
      <td> </td>
      <td> </td>
      <td> </td>
      <td> </td>
      <td> </td>
      <td> </td>
      <td> </td>
      <td> </td>
    </tr>
    <tr>
      <td class="scrollRowThead"><input type="checkbox" name="checkbox7" value="checkbox">5</td>
      <td>单元格2</td>
      <td>单元格3</td>
      <td>单元格4</td>
      <td>单元格5</td>
      <td> </td>
      <td> </td>
      <td> </td>
      <td> </td>
      <td> </td>
      <td> </td>
      <td> </td>
      <td> </td>
    </tr>
  </table>
</div>
</body>
</html>

抱歉!评论已关闭.