当我使用固定在表行的位置时Firefox问题

时间:2012-02-14 07:40:43

标签: html position html-table head

我需要表格的可滚动标题。所以我决定使用postion:修复样式。问题是Firefox&的宽度缩小了。铬。它在Mozilla上运行良好。作为参考,我发布了我的HTML表格代码。

<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>

1 个答案:

答案 0 :(得分: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>