除了填充问题,为什么不建议将.container嵌入.container-fluid?
如果将子容器填充清零(如下面的代码所示),则效果与拥有一个容器相同.此外,似乎拥有不同的全宽和固定宽度布局现在非常普遍.我知道文档说的是什么(LINK),但我很好奇是否有人知道除了填充问题以外的任何事情,保证不推荐这种实现.它是额外的标记还是我遗漏的其他东西?
我问的原因是我最近在很多网站上实现了这个,并且在我所做的测试中没有看到它的明显问题.我想知道是否还有一些潜在的潜在问题会让我考虑停止这种做法.
CSS
.container-fluid .container {
padding-left:0;
padding-right:0;
}
Run Code Online (Sandbox Code Playgroud)
HTML
<div class="container-fluid" style="background-color:aliceblue;">
<div class="row">
<div class="col-xs-12">
<div class="container">
<div class="row">
<div class="col-xs-6" style="background-color:violet">Use this document as a way to quickly start any new project.<br> All you get is this text and a mostly barebones HTML document.</div>
<div class="col-xs-6" style="background-color: lightblue">Use this document as a way to quickly start any new project.<br> All you get is this text and a mostly barebones HTML document.</div>
</div>
</div>
</div> …Run Code Online (Sandbox Code Playgroud)