Easy Tutorial
❮ Pr Grid Gap Css3 Pr Text Overflow ❯

CSS right Property

Example

Set the right edge of an image 5 pixels to the left of the right edge of its containing element:


Property Definition and Usage

For static elements, it is auto; for length values, it is the corresponding absolute length; for percentage values, it is the specified value; otherwise, it is auto. For relatively positioned elements, the computed value of left always equals right.

The right property specifies the right edge of an element. This property defines the offset between the right margin edge of a positioned element and the right edge of its containing block.

Note: If the "position" property is set to "static", the "right" property has no effect.

Default value: auto
Inherited: no
--- ---
Version: CSS2
--- ---
JavaScript syntax: object.style.right="50px"
--- ---

Browser Support

The numbers in the table specify the first browser version that fully supports the property.

Property
right 1.0 5.5 1.0 1.0 5.0

Property Values

Value Description
auto Default value. The right edge position is calculated by the browser.
% Sets the right position in percent of the containing element. Negative values are allowed.
length Sets the right position using px, cm, etc. Negative values are allowed.
inherit Specifies that the value of the right property should be inherited from the parent element.

Related Articles

CSS Tutorial: CSS Positioning

❮ Pr Grid Gap Css3 Pr Text Overflow ❯