Skip to Content


CSS Reference / margin

margin

A shorthand property for setting all four margins at the same place in the style sheet. Negative values are allowed. The shorthand margin properties are defined clockwise starting from top.

Values:

Examples:

  1. margin: 10px; /* all margins */
  2. margin: 2em 4em; /* 2em top/bottom and 4em sides */
  3. margin: 5px 6px 7px 8px; /* different margins on all sides */

Browser support:

  • Internet Explorer 4+
  • Netscape 4+
  • Opera 3.5+

Related properties:

back to list



Search

Sponsors

Logo design for $149

Advertise here