CSS right property
Set the right edge of the image 5 pixels to the left on the right edge of its containing element:
{
position:absolute;
right:5px;
}
Try it out . . .
Description of property definition and use
For static elements, it is auto, for length values, it is the corresponding absolute length, for percentage values, it is specified, otherwise it is auto. For relative definition elements, the calculated value of left is always equal to right.
The right property specifies the right edge of the element. This property defines the offset between the right margin boundary of the anchor element and the right boundary of the block it contains.
Note: If the value of the "position" property is "static," setting the "right" property will have no effect.
Default: | auto |
---|---|
Inherited: | no |
Version: | CSS2 |
JavaScript syntax: | object .style.right="50px" |
Browser support
The numbers in the table support the first browser version number of the property.
Attributes | |||||
---|---|---|---|---|---|
right | 1.0 | 5.5 | 1.0 | 1.0 | 5.0 |
The property value
Value | Describe |
---|---|
auto | The default. The position of the right edge is calculated from the browser. |
% | Sets the right position in percentage of elements contained. Negative values can be used. |
length | Use units such as px, cm to set the right position of the element. Negative values can be used. |
inherit | Specifies that the value of the right property should be inherited from the parent element. |
Related articles
CSS tutorial: CSS Positioning