loading...
markdown guide
 

Looking at the MDN article for CSS margin it says:

When two values are specified, the first margin applies to the top and bottom, the second to the left and right.

Citation: developer.mozilla.org/en-US/docs/W...

So margin: 0 auto is the same as the following 4 properties:

margin-top: 0;
margin-right: auto;
margin-bottom: 0;
margin-left: auto;

When margin-left and margin-right are both auto that will usually center-align a Block Level Element, like a <div>.

 
Classic DEV Post from May 28 '19

Those silly mistakes we all make

Silly mistakes happen to us all.

सुजन खड्का🇳🇵 profile image
software developer👨🏻‍💻|