CSS right Property
CSS right
property specifies the right position of an element in combination with the position property.
If position: absolute;
or position: fixed;
: The right
property sets the right position of an element to a unit to the right of the right position of its nearest positioned ancestor.
Usages
The following table outline the usages and version history of this property.
Default value: | auto |
Applies to: | Positioned elements |
Inherited: | No |
Version: | CSS2 |
JavaScript Syntax: | object.style.right = "15px" |
Syntax
Here is a syntax for the CSS right
property
right: auto | length | percentage | initial | inherit;
Property Values
The following table describes the values of this property.
Value | Description |
---|---|
auto | Default. Browser will calculate the right position for the element |
length | Specifies the length value expressed in px, pt, cm, em, etc. to set right position Negative values are allowed. |
percentage | Specifies the percentage value to set right position |
initial | Sets default value of this property |
inherit | Inherits this property from its parent element |
Examples
The example below shows to sets right property.
div.one {
right: 10%;
position: absolute;
}
div.two {
right: 0;
position: absolute;
}
Browser Compatibility
- Google Chrome 1+
- Mozilla Firefox 1+
- Internet Explorer 5+
- Opera 6+
- Safari 1+
Note: Here details of browser compatibility with version number may be this is bug and not supported. But recommended to always use latest Web browser.