CSS margin-right Property


The margin-right CSS property is used to specify an element's right margin. It places the margin-area on the element's right side. Negative values are also acceptable. The margin-right property has a value of zero by default.

Syntax

Example

Preview

Property Values

Value Description
length Specifies a fixed right margin in pixels, points, centimeters, and so on. 0px is the default value. Learn more about length units.
% Sets the right margin as a percentage of the width of the containing element.
auto A right margin is calculated by the browser.
initial This property is set to its default value.
inherit This property is inherited from its parent element.

Supported Browsers

Property Chrome Firefox Safari Edge / IE Opera
margin-right 1.0 1.0 1.0 6.0 3.5