CSS rightProperty


Example

Set the image's right edge to a position 5 pixels to the left of its containing element's right edge:

img
{
position:absolute;
right:5px;
}

Try it Yourself »

Attribute definition and usage instructions

For static elements, auto; for length values, the corresponding absolute length; for percentage values, the specified value; otherwise, auto. For relatively positioned elements, the computed value of left is always equal to 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 value of the "position" property is "static", setting 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 supports this property.

Property
right 1.0 5.5 1.0 1.0 5.0

Property value

Value Description
auto Default value. The browser calculates the position of the right edge.
% Sets the right position as a percentage of the containing element. Negative values may be used.
length Sets the right position of the element using units such as px, cm. Negative values may be used.
inherit Specifies that the value of the right property should be inherited from the parent element.


Related Articles

CSS Tutorial:CSS Positioning

other extensions