Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML DOM Style right Property

Style right Property

Style Object Reference The Style object


Definition and Usage

The right property sets or returns the right position of a positioned element.

This property specifies the right position of an element, including: padding, scrollbar, border, and margin.

**Tip:** A positioned element is an element whose position property is set to: relative, absolute, or fixed.

Syntax

Set the right property:

Object.style.right="auto|

length

|

%

|inherit"

Return the right property:

Object.style.right

Value Description
auto Default. The right position is calculated by the browser.
length Using units such as px, cm, etc., defines the position from the element's right edge to the right edge of the nearest positioned parent element. Negative values are allowed.
% Defines the position, as a percentage, from the element's right edge to the right edge of the nearest positioned parent element.
inherit The value of the right property is inherited from the parent element.

Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the right property.

**Note:** IE7 and earlier versions do not support the "inherit" value. IE8 supports "inherit" only if a !DOCTYPE is specified. IE9 supports "inherit".


Example

Example

Set the right position of a button:

Runoob Tutorial(runoob.com)

Try it »


Style Object Reference The Style object