Style right property
- Forrige side resize
- Næste side scrollBehavior
- Gå tilbage til forrige niveau HTML DOM Style Object
Definition and Usage
right
Property to set or return the right position of the positioned element.
This property specifies the right position of the element, including padding, scrollbars, borders, and margins.
Tip:The positioned element is set with the position property to:relative
,absolute
or fixed
elements.
Tip:To set or return the left position of the positioned element, use left property.
See also:
CSS Tutorial:CSS Positioning
CSS Reference Manual:right property
Instance
Example 1
Set the right position of the <div> element:
document.getElementById("myDIV").style.right = "100px";
Example 2
Use negative value - Set the right position of the <div> element:
document.getElementById("myDiv").style.right = "-100px";
Example 3
Return the right position of the <div> element:
alert(document.getElementById("myDiv").style.right);
Syntax
Return right property:
object.style.right
Set right property:
object.style.right = "auto|length|%|initial|inherit"
Property value
Value | Description |
---|---|
auto | Allows the browser to set the right position. Default. |
length | Sets the right position in length units. Negative values are allowed. |
% | Sets the right position in percentage of the parent element's width. |
initial | Sets this property to its default value. See initial. |
inherit | Inherits this property from its parent element. See inherit. |
Technical details
Default value: | auto |
---|---|
Return value: | A string representing the right position of the located element. |
CSS version: | CSS2 |
Browser support
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Support | Support | Support | Support | Support |
- Forrige side resize
- Næste side scrollBehavior
- Gå tilbage til forrige niveau HTML DOM Style Object