【问题标题】:Add horizontal scrollbar in table cell within container在容器内的表格单元格中添加水平滚动条
【发布时间】:2016-11-07 05:22:43
【问题描述】:

我有一个<div class="container">,里面有<table class="table">,看起来不错。直到单元格变宽,表格才会扩展到内容的完整大小。

<div class="container">
    <table class="table">
        <tr>
            <td>Caption</td>
            <td>Some very long string that makes the contents to overflow, actually mich like this actual example in StackOverflow.
            </td>
        </tr>
    </table>
</div>

当内容比容器宽时,我希望有一个水平滚动条(实际上就像 StackOverflow 一样......)。

我该怎么做?在&lt;td&gt; 上添加style="overflow-x: scroll" 没有任何作用。

【问题讨论】:

标签: twitter-bootstrap


【解决方案1】:
  1. .container 一个max-width
  2. 然后将overflow 样式规则应用于.container

示例:

.container {
max-width: 400px;
overflow-x: scroll;
}

【讨论】:

  • 我真的不想触碰 Bootstrap 给我的默认设置。
猜你喜欢
  • 2019-02-20
  • 1970-01-01
  • 1970-01-01
  • 2011-07-28
  • 1970-01-01
  • 1970-01-01
  • 2017-02-03
  • 1970-01-01
  • 2020-05-09
相关资源
最近更新 更多