Bootstrap匹配表宽度与容器

时间:2014-03-30 22:22:50

标签: javascript jquery html css twitter-bootstrap

如何将表格的宽度与其容器相匹配?没有任何css更改,我的表溢出并且比它的容器宽得多。

JSFiddle示例:http://jsfiddle.net/Tet8L/ Table is overflowing out of container.

当我把宽度设置为auto时,我得到的表只填充容器的一部分。

.table {
  width: auto; (or fixed or none)
}

JSFiddle示例:http://jsfiddle.net/DDnSL/ Table width is too short.

有没有办法让我的桌子自动填满整个容器?<​​/ p>

1 个答案:

答案 0 :(得分:2)

在您的HTML中

<div class="starter-template">
     <div class="container">
         ...
     </div>
</div>

将此更改为

<div class="starter-template">
     <div class="container-fluid">
         ...
     </div>
</div>

Working Example

<强>更新

忘记我刚写的内容,只需删除.container div,因为你的代码中已经有.container div。我刚看了一下Bootstrap文档,他们说,

  

默认情况下,容器不可嵌套

Bootstrap Docs (containers)

<div class="starter-template">
     <div>
         ...
     </div>
</div>

Updated Example

相关问题