我有一个小节,其中包含两篇文章,每篇都归为“ col-xs-6”。这两篇文章都很好地结合在一起,占据了全角。
在这之后,我有一个旁注和一个页脚,每个都称为“ col-xs-12”;但是,这些全宽有点害羞。
但是,当我将其类更改为“ col-xs-13”时,它将变为全角。我知道我可以将所有类都更改为“ col-s-12”并解决问题,但是如果2篇xs-6文章加了全角,那么一个xs-12难道不应该这样做吗?为什么不?
body {
background: #F0E68C;
text-align: left;
}
header {
background: green;
}
nav {
background: blue;
}
section {
background: orange;
}
article {
background: red;
}
aside {
background: yellow;
}
footer {
background: orange;
}
section {
background: pink;
}
<body class="container-fluid">
<header class="jumbotron bg-primary text-center">
<nav>
<ul>
<li>Your menu</li>
</ul>
</nav>
</header>
<section class="row">
<article class="col-xs-6">
<header>
<h2>Article title</h2>
<p>Posted on
<time datetime="2009-09-04T16:31:24+02:00">September 4th 2009</time>by <a href="#">Writer</a> - <a href="#comments">6 comments</a>
</p>
</header>
<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.</p>
</article>
<article class="col-xs-6">
<header>
<h2>Article title</h2>
<p>Posted on
<time datetime="2009-09-04T16:31:24+02:00">September 4th 2009</time>by <a href="#">Writer</a> - <a href="#comments">6 comments</a>
</p>
</header>
<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.</p>
</article>
</section>
<aside class="row col-xs-13">
<h2>About section</h2>
<p>Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.</p>
</aside>
<footer class="row col-xs-13">
<p>Copyright 2009 Your name</p>
</footer>
最佳答案
引导程序col-*-*
类定义添加15px
padding-left
和padding-right
。在标准的Bootstrap 3样式表中不存在col-*-13
,因此未应用任何列填充,从而使它看起来更全宽,因为row
左右具有负边距-15px
可以有效地扩展其占用的空间。col-*-*
上的这些正填充与row
类定义的负边距相结合,可以确保网格正常运行。我会避免将其删除。
如果需要使元素看起来更“全角”,但应在标准container
尺寸之内。您可以尝试在自定义类中包装元素,并为其提供背景/图案/等。
从Bootstrap文档中:
列通过填充创建装订线(列内容之间的间隙)。那
第一列和最后一列的填充通过负数在行中偏移
行的边距。
负差是为什么以下示例被忽略。是这样
网格列中的内容与非网格内容对齐。