For Boostrap 4
I DO NOT recommend that you use a container
within the other. Even you do not need this to do this "nesting" with Grid, as you can consult directly in the official documentation on Nesting Grid
See that only COL-*
can be a 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 the spacing you should use the native BS4 classes as p
or m
to margin
and padding
Here you have the official documentation link
NoticethatyoudonotneedCSSbeyondtheoriginalBS4,theonlythingIdidwithCSSwastoputthebackgroundcolors.Seethecodefortheimageabove:
.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>
PORTUGUESE
"Bootstrap requires an element that contains site content and hosts our grid system.You can choose one of the two containers to use in your projects.Note that due to the fill and more, no container
is nested. "
PORTUGUESE
"Content should be placed inside columns and only columns can be immediate children of rows
."