To the Boostrap 4
I DO NOT recommend that you use a container
within each other. Until pq does not need this to make this "nesting" with the Grid, as you can see directly in the official documentation about Nesting Grid
https://getbootstrap.com/docs/4.0/layout/grid/#nesting
See that only COL-*
can be the direct child of ROW
In a grid layout, content must be placed Within Columns and only Columns may be immediate Children of Rows.
To give spacing vc must use BS4 native classes such as p
or m
for margin
and padding
Here is the official documentation https://getbootstrap.com/docs/4.0/utilities/spacing/
Note that you don’t need CSS other than the original BS4, the only thing I did with CSS was put the background colors. See the code for the image above:
.container {
background-color: purple;
}
.row {
background-color: cornflowerblue;
}
.col-3 {
background-color: tomato;
}
.col-9 {
background-color: yellow;
}
.col-12 {
background-color: silver;
}
<link rel="stylesheet" type="text/css" media="screen" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" />
<div class="container">
<div class="row p-4">
<div class="col-3 p-4">
col-3
</div>
<div class="col-9 p-4">
<div class="col-12 mb-2">col-12</div>
<div class="col-12 mb-2">col-12</div>
<div class="col-12">col-12</div>
</div>
</div>
</div>
If you are still using Bootstrap 3 see that:
Bootstrap requires a containing element to wrap site Contents and house our grid system. You may Choose one of two containers to use in your Projects. Note that, due to padding and more, neither container is nestable.
PORTUGUÊS
"Bootstrap requires an element that contains website content and hosts our grid system. You can choose one of the two containers to use in your projects. Note that due to filling and more, none container
is nested."
Another point: Row > Container
(that’s wrong!)
Content should be placed Within Columns, and only Columns may be immediate Children of rows
.
PORTUGUÊS
"Content should be placed inside columns and only columns can be immediate children of rows
."
Dare you be, just COL-*
can be the direct child of a ROW
Source of official documentation: https://getbootstrap.com/docs/3.3/css/#grid
These gray lines inside the yellow box eh just simulating what would be a text or you really need them to be a div ?
– hugocsl