1
我有時會發現自己希望爲內容位於標準容器內的網站的一部分放置全寬背景。例如:爲什麼不應該引導容器嵌套?
<div class="container">
<!--here is a section of awesome things that doesn't need a full width background -->
</div>
<div class="container-fluid" style="background-color: purple">
<div class="container>
<p>This is an average paragraph</p>
</div>
</div>
Bootstrap says NOT to nest containers。
Note that, due to padding and more, neither container is nestable.
我知道我可以在一個類中創建一個不同的div,但我不知道嵌套容器的具體危險可能是什麼?
可以使用倍數,但沒有嵌套。而不考慮風險。風險在於bootstrap中的一些內容依賴於相對選擇器。這些可能會在嵌套的情況下破裂。我之前已經遇到過嵌套各種元素。 – Derple