Basically, Bootstrap
is written in .container
and describes .row
.
But why does Bootstrap
bother .container
with 15px
and .row
with -15px
?
Affected Source Links:
https://github.com/twbs/bootstrap/blob/v4-dev/dist/css/bootstrap-grid.css#L22
https://github.com/twbs/bootstrap/blob/v4-dev/dist/css/bootstrap-grid.css#L62
If you only write .row
in .container
, it is useless to do 15px
in .container
and -15px
in .row
.
However, .container
is a container as the name suggests, so I often put something other than .row
.For example, considering the example below, .container
uses 15px
and -15px
uses .row
to align the title, sentence, and in the grid.In short, it's to make it easier for developers to use.
<div class="container">
<h2>Title </h2>
<p> Sentences <p>
<div class="row">
<div class="col-sm">
One of three columns
</div>
<div class="col-sm">
One of three columns
</div>
<div class="col-sm">
One of three columns
</div>
</div>
</div>
If you use minus margin in row, you can put plus margin elements in it.
Maybe it's because it's the purpose?
I think I can put several boxes in the row with float, but it automatically folds back cleanly
It seems to have been an ingenuity to display...
I found a site explaining that part
You can also specify a negative value!
With Bootstrap, you don't know these CSS tricks
CSS.
I think it's popular because it has a beautiful layout.
© 2024 OneMinuteCode. All rights reserved.