Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

CSS margin-right property


May 05, 2021 CSS Reference Manual


Table of contents


CSS margin-right property


Set the right margin of a p element:

P
{
margin-right:2cm;
}

Try it out . . .

Description of property definition and use

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

Note: Negative values are allowed.

Default: 0
Inherited: no
Version: CSS1
JavaScript syntax: object .style.marginRight="10px"


Browser support

The numbers in the table support the first browser version number of the property.

Attributes
margin-right 1.0 6.0 1.0 1.0 3.5

The property value

Value Describe
auto The right margin of the browser settings.
length Define a fixed right margin. The default is 0.
% Defines the right margin based on the percentage of the total height of the parent object.
inherit The rule is that the right margin should be inherited from the parent element.


Related articles

CSS tutorial: CSS Margin