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?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
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.
回答2:
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.