Bootstrap's container
class has paddings on both side:
.container-fixed(@gutter: @grid-gutter-width) {
padding-left: (@gutter / 2);
padding-right: (@gutter / 2);
}
While row
class has negative margins
:
.make-row(@gutter: @grid-gutter-width) {
margin-left: (@gutter / -2);
margin-right: (@gutter / -2);
}
So when we put html like that:
<div class="container">
<div class="row">
...
</div>
</div>
the content within the row
class takes all the space from left to right side of the container offseting the padding
using negaive margins
. I'm wondering why this approach is used? I've also seen it being used for navbars, specifically navbar-right
class has negative margin.