html - Bootstrap 3 表 - 表响应不起作用

标签 html twitter-bootstrap twitter-bootstrap-3 responsive-design html-table

我正在为一个网站项目使用 bootstrap 3。我正在尝试创建一个带有响应表的页面,这样当表太大时我就会有滚动条。我做了一个这样的测试用例:

<div class="row">
  <h4>Nuværende kurser</h4>
  <div class="col-12 col-sm-12 col-lg-12">
    <div class="table-responsive">
      <table class="table">
        <thead>
          <tr>
            <th>#</th>
            <th>Table heading</th>
            <th>Table heading</th>
            <th>Table heading</th>
            <th>Table heading</th>
            <th>Table heading</th>
            <th>Table heading</th>
          </tr>
        </thead>
        <tbody>
          <tr>
            <td>1</td>
            <td>Table cell</td>
            <td>Table cell</td>
            <td>Table cell</td>
            <td>Table cell</td>
            <td>Table cell</td>
            <td>Table cell</td>
          </tr>
          <tr>
            <td>2</td>
            <td>Table cell</td>
            <td>Table cell</td>
            <td>Table cell</td>
            <td>Table cell</td>
            <td>Table cell</td>
            <td>Table cell</td>
          </tr>
          <tr>
            <td>3</td>
            <td>Table cell</td>
            <td>Table cell</td>
            <td>Table cell</td>
            <td>Table cell</td>
            <td>Table cell</td>
            <td>Table cell</td>
          </tr>
        </tbody>
      </table>
    </div>
  </div><!-- end col-12 -->
</div><!-- end row -->

现在,问题是它没有添加滚动条,它只是将网站扩展到表格的宽度。

请看这里的截图:

enter image description here

我已经看到它在其他几个网站上运行,所以我正在做的事情......是错误的。

最佳答案

用这个替换你的表格响应

<div class='table-responsive'> -> <div style="overflow-x:auto;">

关于html - Bootstrap 3 表 - 表响应不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26394072/

相关文章:

javascript - AngularJS 在处理 HTML Void 元素的自定义指令时是否有错误

javascript - 如何使用javascript实现验证?

html - css - 从外部样式表转换为内联样式表;不确定一些 "dropdown"样式去了哪里

jquery - 带有 Bootstrap Accordion 的 CakePHP Formhelper

html - Bootstrap 下拉下拉式左拉不起作用

javascript - 使用平板电脑大小的屏幕时尝试删除额外的空间

javascript - 移动设备上本地存储(html5)的安全性?

javascript - 将确认 Bootstrap 模式/对话框添加到复选框

ios - Bootstrap 3 中 Canvas 外移动菜单的问题

html - 如何在Bootstrap 3.0中修复左侧菜单?