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

<style>
      .example-Setting-Margins-for-Each-Side-left{
        margin-left: 50px;
      }
      .example-Setting-Margins-for-Each-Side-right {
        margin-right: 50px;
      }
      .example-Setting-Margins-for-Each-Side-top {
        margin-top: 50px;
      }
      .example-Setting-Margins-for-Each-Side-bottom {
        margin-bottom: 50px;
      }
 </style>
    <p class="example-Setting-Margins-for-Each-Side-right">
        This text has a right margin of 50 pixels.
    </p>
    <p class="example-Setting-Margins-for-Each-Side-left">
        This text has a left margin of 50 pixels.
    </p>
    <p class="example-Setting-Margins-for-Each-Side-top">
        This text has a top margin of 50 pixels.
    </p>
    <p class="example-Setting-Margins-for-Each-Side-bottom">
        This text has a bottom margin of 50 pixels.
    </p>
    <p>
        This text has no left margin set.
    </p>

Output

   

        This text has a right margin of 50 pixels.   

   

        This text has a left margin of 50 pixels.   

   

        This text has a top margin of 50 pixels.   

   

        This text has a bottom margin of 50 pixels.   

   

        This text has no left margin set.