Edit

Setting Margins for Each Side

You can set the margin property on each side using margin-top, margin-bottom, margin-right, margin-left attributes.

Example of Code

<!DOCTYPE html>
<html>
<head>
    <title></title>
    <style>
      p {
        background: gold;
      }
      .left-margin {
        margin-left: 60px;
      }
      .right-margin {
        margin-left: 60px;
      }
      .top-margin {
        margin-left: 60px;
      }
      .bottom-margin {
        margin-left: 60px;
      }
    </style>
</head>
<body>
    <p class="left-margin">
        This text has a left margin of 60 pixels.
    </p>
    <p class="right-margin">
        This text has a right margin of 60 pixels.
    </p>
    <p class="top-margin">
        This text has a top margin of 60 pixels.
    </p>
    <p class="bottom-margin">
        This text has a bottom margin of 60 pixels.
    </p>
    <p>
        This text has no left margin set.
    </p>
</body>
</html>

Output

           

        This text has a left margin of 60 pixels.   

   

        This text has a right margin of 60 pixels.   

   

        This text has a top margin of 60 pixels.   

   

        This text has a bottom margin of 60 pixels.   

   

        This text has no left margin set.