Wednesday, 28 October 2015

CSS Margin

CSS Margins

The CSS margin properties set the size of the white space OUTSIDE the border.

With CSS, you have full control over the margins. There are CSS properties for setting the margin for each side of an element (top, right, bottom, and left).

Margin - Individual Sides

CSS has properties for specifying the margin for each side of an element:
  • margin-top
  • margin-right
  • margin-bottom
  • margin-left
All the margin properties can have the following values:
  • auto - the browser calculates the margin
  • length - specifies a margin in px, pt, cm, etc.
  • % - specifies a margin in % of the width of the containing element
  • inherit - specifies that the margin should be inherited from the parent elemenT.
EXAMPLE:
{
    margin-top: 100px;
    margin-bottom: 100px;
    margin-right: 150px;
    margin-left: 80px;
}

No comments:

Post a Comment