2012-02-14 71 views
0

我需要表格的可滚动标题。所以我决定使用postion:固定在样式上。问题是Chrome的Chrome &的宽度缩小了。它在Mozilla上运行良好。为了您的参考,我发布了我的HTML表格代码。当我使用固定在表格行的位置时出现Firefox问题

<html> 
<head> 
</head> 
<body> 
    <table width="150%"> 
     <thead> 
     <tr> 
      <th width="50%" align="left">Head 1</th> 
      <th width="50%" align="left">Head 2</th> 
     </tr> 
     </thead> 
     <tbody> 
     <tr> 
      <td>Value 1</td> 
      <td>Value 2</td> 
     </tr> 
     <tr> 
      <td>Value 1</td> 
      <td>Value 2</td> 
     </tr> 
     <tr> 
      <td>Value 1</td> 
      <td>Value 2</td> 
     </tr> 
     <tr> 
      <td>Value 1</td> 
      <td>Value 2</td> 
     </tr> 
     <tr> 
      <td>Value 1</td> 
      <td>Value 2</td> 
     </tr> 
     <tr> 
      <td>Value 1</td> 
      <td>Value 2</td> 
     </tr> 
     <tr> 
      <td>Value 1</td> 
      <td>Value 2</td> 
     </tr> 
     <tr> 
      <td>Value 1</td> 
      <td>Value 2</td> 
     </tr> 
     <tr> 
      <td>Value 1</td> 
      <td>Value 2</td> 
     </tr> 
     <tr> 
      <td>Value 1</td> 
      <td>Value 2</td> 
     </tr> 
     <tr> 
      <td>Value 1</td> 
      <td>Value 2</td> 
     </tr> 
     <tr> 
      <td>Value 1</td> 
      <td>Value 2</td> 
     </tr> 
     <tr> 
      <td>Value 1</td> 
      <td>Value 2</td> 
     </tr> 
     <tr> 
      <td>Value 1</td> 
      <td>Value 2</td> 
     </tr> 
     <tr> 
      <td>Value 1</td> 
      <td>Value 2</td> 
     </tr> 
     <tr> 
      <td>Value 1</td> 
      <td>Value 2</td> 
     </tr> 
     <tr> 
      <td>Value 1</td> 
      <td>Value 2</td> 
     </tr> 
     <tr> 
      <td>Value 1</td> 
      <td>Value 2</td> 
     </tr> 
     <tr> 
      <td>Value 1</td> 
      <td>Value 2</td> 
     </tr> 
     <tr> 
      <td>Value 1</td> 
      <td>Value 2</td> 
     </tr> 
     <tr> 
      <td>Value 1</td> 
      <td>Value 2</td> 
     </tr> 
     <tr> 
      <td>Value 1</td> 
      <td>Value 2</td> 
     </tr> 
     <tr> 
      <td>Value 1</td> 
      <td>Value 2</td> 
     </tr> 
     <tr> 
      <td>Value 1</td> 
      <td>Value 2</td> 
     </tr> 
     <tr> 
      <td>Value 1</td> 
      <td>Value 2</td> 
     </tr> 
     <tr> 
      <td>Value 1</td> 
      <td>Value 2</td> 
     </tr> 
     <tr> 
      <td>Value 1</td> 
      <td>Value 2</td> 
     </tr> 
     <tr> 
      <td>Value 1</td> 
      <td>Value 2</td> 
     </tr> 
     <tr> 
      <td>Value 1</td> 
      <td>Value 2</td> 
     </tr> 
     <tr> 
      <td>Value 1</td> 
      <td>Value 2</td> 
     </tr> 
     <tr> 
      <td>Value 1</td> 
      <td>Value 2</td> 
     </tr> 
     <tr> 
      <td>Value 1</td> 
      <td>Value 2</td> 
     </tr> 
     <tr> 
      <td>Value 1</td> 
      <td>Value 2</td> 
     </tr> 
     <tr> 
      <td>Value 1</td> 
      <td>Value 2</td> 
     </tr> 
     </tbody> 
     <tfoot> 
     <tr><td>Foot 1</td></tr> 
     </tfoot> 
    </table> 

</body> 
</html> 

回答

0

这个怎么样?

<th align="left" style="position:fixed;float:left;">Head 1</th> 
<th align="left" style="position:fixed;float:right;left:75%;">Head 2</th> 
+0

我试过这个。它不是在寻找这个,滚动条来的表。我不希望滚动表格,滚动条将显示整个页面,并且表格标题需要可以垂直滚动和水平滚动。 – 2012-02-14 08:03:46

+0

注意:我的表格宽度是150%而不是100% – 2012-02-14 08:04:16

+0

它正在寻找水平滚动。不适用于垂直滚动。 – 2012-02-14 09:44:27