Bootstrap行不占用100%宽度

时间:2017-05-02 15:39:07

标签: html css twitter-bootstrap

我有一个自举网格布局,但该行不占用100%宽度。我正在使用Bootstrap 4 alpha 6.这是HTML:

<div class="container-fluid">
  <h1 class="center-text"  id="heading">[Enter Heaading Here]</h1>
  <div class="container">
    <div height="100px" class="row border-show">
      <div class="col-4" id="one"></div>
      <div class="col-4" id="two"></div>
      <div class="col-4" id="three"></div>
    </div>
  </div>
</div>

这是CSS:

.center-text{
  text-align: center;
}
#heading{
  padding: 60px;
}
.border-show{
  border-style: solid;
  border-color: black;
}

2 个答案:

答案 0 :(得分:11)

container中删除它。 container不是100%宽度,不应嵌套在另一个容器中。

答案 1 :(得分:0)

万一其他人遇到了这个问题,而答案却不能解决他们的问题,导致我的问题是因为我没有意识到自己正在添加一行并试图在Bootstrap导航栏中设置列。 navbar默认情况下已经在其中包含一个类似于网格的系统,因此,如果您尝试在其中添加列,则似乎将其推到了边缘。无论如何,它们不是必需的。

因此,如果此答案不能解决您的问题,请检查是否在另一个已处理间距的Bootstrap组件内。您可能正在尝试对内容进行双重定界!