Reputation: 81
Just out of curiosity, why bootstrap uses -15px
left and right margin
s which going to cancel the 15px
left and right padding
on .container
and .container-fluid
classes.
Why set padding and then cancel it with a negative margin on the child?
Upvotes: 8
Views: 2770
Reputation: 1502
A negative margin on row avoids the blank space that would be left because of padding of first column. In its absence the whole layout will look a little indented.
Upvotes: 2
Reputation: 3213
As in Official Bootstrap Website said:
Rows are wrappers for columns. Each column has horizontal
padding
(called a gutter) for controlling the space between them. Thispadding
is then counteracted on the rows with negativemargins
. This way, all the content in your columns is visually aligned down the left side.
Upvotes: 1