拆分html表

时间:2012-05-17 16:01:55

标签: html css

我有一个html表,看起来像这样:

<table>
  <thead>
    <tr>
      <th >title1</th>
      <th >title2</th>
      <th >title3</th>
      <th >title4</th>
      <th >title5</th>
      <th >title6</th>
      <th >title7</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>data1</td>
      ...
      <td>data7</td>
    </tr>
  </tbody>

我遇到的问题是我只有大约300px来放入所有这些信息,我想知道是否有某种方式我可以告诉表分裂,如果它达到300px限制的结束。这有可能吗?或者我会回到使用div?

1 个答案:

答案 0 :(得分:0)

我不确定'拆分'是什么,但一个好的选择是将表包装在设置了overflow-x: auto的容器中。这将使其可滚动。

<强> Live Example

相关问题