繁体   English   中英

将表格列宽设置为内容大小? 或者设置一个特定的宽度px?

[英]Set table column widths to content size? Or set a specific width px?

我正在使用bootstrap 3,我目前有一个大约12列的表。 我希望表格可以水平滚动。 由于某种原因,它使列超小,所以内容堆叠...有什么办法解决这个问题? 我试过改变th元素的宽度,但它没有做任何事情。

<table class="table">
  <thead>
    <tr>
      <th>First Name</th>
      ......
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>James</td>
      .......
    </tr>
  </tbody>
</table>

尝试

<div class="table-responsive">

最后通过添加一个white-space: nowrap;来修复它white-space: nowrap; 在TH和TR元素上,使列只是内容的大小。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM