html - 为什么我的 bootstrap 响应表没有缩小

标签 html .net twitter-bootstrap twitter-bootstrap-3

在 asp.net mvc5 上工作。为什么我的响应表不收缩?当我调整浏览器大小时而不是滚动出现时。

我的表格语法如下:

  <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>
    </tbody>
  </table>
  </div>
  </div><!-- end col-12 -->

如何让我的 table 缩小。

enter image description here

最佳答案

此代码似乎按预期工作。

table-responsive允许表格自由溢出,以便内容将其推到最大大小。如果这太宽,请根据您的喜好添加一个具有最大宽度的自定义类。

有关替代响应表方法,请查看:http://www.webadvanced.com/news/painless-responsive-tables

附言col-12不在 Bootstrap 和 col-sm-12 中对所有较大的视口(viewport)有效 col-lg-12多余的。

关于html - 为什么我的 bootstrap 响应表没有缩小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35378176/

相关文章:

html - 避免点击链接周围出现虚线边框

html - 一行有 3 个元素的网格布局,每个元素的宽度是自动的

C# 如何用另一个集合中的对象替换一个集合中的对象

php - 在 session 中存储错误消息并显示在另一个页面上

javascript - :blank selector not working on checkbox jQuery Validate()

c# - 来自队列的大对象堆和字符串对象

.net - 使用 SVN 时如何忽略 .NET 数据集定义 (XSD) 中属性顺序的变化?

html - 使用 Bootstrap 时浏览器之间的 CSS 问题

javascript - 从 Bootstrap 模式加载的远程页面调用 AngularJS 函数

css - 当浏览器宽度太小时,列会缩回