Left Margin

Many times we would need to set margin for our objects. This will set the left margin of the object.
margin-left: 10px;
margin-left: 10pt;
margin-left: 10%;
margin-left: auto;
It takes the following values:
  1. pt: You can set values in points. (e.g: 10pt or 100pt).
  2. px: You can set values in pixels. (e.g: 10px or 100px).
  3. %: You can set values in percentage. (e.g: 10% or 100%).
  4. auto: This will set a automatic / default margin.
The following CSS code example shows how to set the value of the left margin:
<title>CSS margin example</title>
<style type=”text/css”>
margin-left: 2cm
This paragraph does not have a specified margin. </p>
<p class=”leftmargin”> This paragraph has a left margin of 2cm. </p>


Scroll to Top