168 of 313 menu

The margin-right property

The margin-right property sets a margin at the right of an element. The value of the property is any size units or the key property auto, which allows the browser to independently calculate the element margin.

Syntax

selector { margin-right: value; }

Example

Let's give the block the 50px right margin:

<div id="parent"> <div id="elem"></div> </div> #parent { border: 1px solid green; display: inline-block; } #elem { margin-right: 50px; border: 1px solid red; width: 100px; height: 100px; }

:

See also

  • the margin-top property
    that sets a top margin
  • the margin-bottom property,
    that sets a bottom margin
  • the margin-left property
    that sets a left margin
  • the margin property
    that is a shorthand for a margin
  • the padding property
    that sets a padding
byenru