CSS margin-right Property


The margin-right property in CSS is used to set the right margin of an element. It sets the margin-area on the right side of the element. Negative values are also allowed. The default value of margin-right property is zero.

The margin-right property sets the right margin of an element.

CSS Syntax

margin-right: length|auto|initial|inherit;

Note

  • The value in the CSS margin-right property can be expressed as either a fixed value or as a percentage.
  • Negative values are allowed in the CSS margin-right property.
  • When the value is provided as a percentage, it is relative to the width of the containing block.

Supported Browsers:

  • Chrome
  • Android
  • Firefox (Gecko)
  • Firefox Mobile (Gecko)
  • Internet Explorer (IE)
  • IE Phone
  • Opera
  • Opera Mobile
  • Safari (WebKit)
  • Safari Mobile

Example -