加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

twitter-bootstrap – 我只应该有一个Bootstrap 3容器?

发布时间:2020-12-18 00:15:25 所属栏目:安全 来源:网络整理
导读:我试图找出Bootstrap 3,有很多麻烦。 Bootstrap 3网站说: Easily center a page’s contents by wrapping its contents in a .container. Containers set width at various media query breakpoints to match our grid system. Note that,due to padding a
我试图找出Bootstrap 3,有很多麻烦。 Bootstrap 3网站说:

Easily center a page’s contents by wrapping its contents in a .container. Containers set
width at various media query breakpoints to match our grid system.

Note that,due to padding and fixed widths,containers are not nestable by default.

前一行似乎支持这一点,因为我不希望嵌套容器将宽度重新设置为超过父级。后一行让我认为,我不应该在一个页面(或最多的兄弟姐妹)上只有一个容器,不管流体/正常等等,而不做一些“额外的”。

那是对的吗?

解决方法

你是不正确的,你不想嵌套.containers。但是,有很多情况下您将拥有多个容器。例如,如果要使用全宽元素(屏幕宽度,而不是容器宽度)。这是非常好的:
<div class="container">
  <div class="col-md-12">
    <p>Content</p>
  </div>
</div>

<div id="full-width-element">
  <p>Other content,stretching full width of the page</p>
</div>

<div class="container">
  <div class="col-md-12">
    <p>Content</p>
  </div>
</div>

看看Bootstrap站点上的示例:http://getbootstrap.com/getting-started/#examples,他们也使用多个.containers。

所以嵌套容器不是没有修改或仔细考虑的好主意。使用多个容器是好的(否则它应该是一个ID而不是一个类)!

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读