how to set text margins in html code example

Example 1: margin for text in html

p {
  /*If you want to apply margin for all four sides with the same amount*/
  margin: 100px;
  /*Margin from top*/
  margin-top: 100px;
  /*Margin from bottom*/
  margin-bottom: 100px;
  /*Margin from right*/
  margin-right: 150px;
  /*Margin from left*/
  margin-left: 80px;
}

Example 2: margin css

/* 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;

Tags:

Css Example