Check out example codes for "margin 0 auto". It will help you in understanding the concepts better.

Code Example 1

/* Apply to all four sides */
margin: 1em;
margin: -3px;

/* vertical | horizontal */
margin: 5% auto;

/* top | horizontal | bottom */
margin: 1em auto 2em; 

/* top | right | bottom | left */
margin: 2px 1em 0 auto;

/* Global values */
margin: inherit;
margin: initial;
margin: unset;

Code Example 2

Specifying 0 tells the browser to set the top and bottom margin to 0.

Specifying auto tells the browser to automatically determine the left
and right margins equally.

It's the same as:

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

Code Example 3

p {
  margin-top: 100px;

  margin-bottom: 100px;

  margin-right: 150px;

  margin-left: 80px;
}

Code Example 4

p {
    margin: 25px 50px 75px 100px; /* Top, Right, Bottom, Left */
}

Learn ReactJs, React Native from akashmittal.com