Bootstrap - 每一行都应该有容器作为直接父级吗? [英] Bootstrap - should each row have container as immediate parent?
问题描述
我知道 column
应该有 row
作为直接父级(或者,准确地说,rows
应该只有 columns
作为其直接子代)但 row
是否必须将 container/container-fluid
作为直接父代?
I know column
should have row
as immediate parent (or, to be precise, rows
should have only columns
as ther immediate children) but does row
must have container/container-fluid
as immediate parent?
我在文档中找不到提到它,我已经看到了两者的例子:rows
有和没有它们各自的 containers
.
I couldn't find mentioning it in docs and i've seen examples of both: where rows
do and don't have their respective containers
.
推荐答案
这取决于 Bootstrap 版本,以及您希望内容如何对齐,但通常需要容器...
It depends on the Bootstrap version, and how you want the content aligned, but generally containers are required...
版本 3.x
"行必须放置在 .container(固定宽度)或.container-fluid(全宽)用于正确对齐和填充."
"Rows must be placed within a .container (fixed-width) or .container-fluid (full-width) for proper alignment and padding."
4.x 版
"容器是 Bootstrap 中最基本的布局元素,它们是使用我们的默认网格系统时需要."
"Containers are the most basic layout element in Bootstrap and are required when using our default grid system."
网格系统的顶层元素是 .row
,因此行应该是容器的直接子元素. Bootstrap4 是更灵活的行 &可以创建列没有装订线,并且间距实用程序可以是用于调整内边距和边距.
The top level element of the grid system is the .row
, and therefore row's should be the immediate child of a container. Bootstrap 4 is more flexible in that rows & columns can be created without gutters, and the spacing utils can be used to adjust padding and margins.
这篇关于Bootstrap - 每一行都应该有容器作为直接父级吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!