From W3C Wiki
< CSS‎ | Properties
Revision as of 18:02, 19 July 2011 by Plehegar (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


The margin-top property sets the top margin of a box.


Values [<length> | <percentage> | auto] | inherit
Initial value 0
Applies to all elements except elements with table display types other than table-caption, table and inline-table
Inherited No


  • <length>

  • <percentage>

  • auto

  • inherit
    Takes the same specified value as the property for the element's parent.


Example A


   background-color: #666;
   background-color: #ccc;
   margin-top: 50px;
   margin-right: 10px;
   margin-bottom: 50px;
   margin-left: 10px;


  <p>This is a paragraph</p>
  <p id="mar">This is a paragraph</p>
  <p>This is a paragraph</p>
  <p>This is a paragraph</p>

Csslist2 margin.png

CSS Reference

The CSS specification defines the margin-top property in 8.3 Margin properties.

See also