Negative left and right margins of .row class in Bootstrap

Just out of curiosity, why bootstrap uses -15pxleft and right margin, which is going to undo classes 15pxleft and right paddingon .containerand .container-fluid.
Why set the indent and then cancel it with a negative field on the child?

+4
source share
2 answers

As the official website Bootstrap said:

Rows are wrappers for columns. Each column has a horizontal padding(called a gutter) to control the space between them. This paddingthen counteracts the lines with a negative value margins. Thus, all the content in your columns is visually aligned on the left side.

+1
source

A negative field in a row avoids the empty space that will be left due to the filling of the first column. In his absence, the entire layout will look a little indented.

+1
source

Source: https://habr.com/ru/post/1690665/


All Articles