Export (0) Print
Expand All
1 out of 2 rated this helpful - Rate this topic

right property

Sets or retrieves the position of the object relative to the right edge of the next positioned object in the document hierarchy.

CSS 2.1, Section 9.3.2

Syntax

right: <length> | <percentage> | auto

Property values

A Variant that specifies or receives one of the following values:

auto

Default. Position is determined by the regular HTML layout of the page.

length

Floating-point number, followed by an absolute units designator (cm, mm, in, pt, or pc) or a relative units designator (em, ex, or px). For more information about the supported length units, see CSS Values and Units Reference.

percentage

Integer, followed by a percent sign (%). The value is a percentage of the width of the parent object.

CSS information

Applies ToAll elements
Mediavisual
Inheritedno
Initial Valueauto

Standards information

Remarks

Only use the right attribute when the position attribute is set; otherwise, the value of the right attribute is ignored.

You cannot use the right property in script to calculate the position of the object in the document, because the value of the right property is a string. Instead, use the pixelRight property or the posRight property.

You cannot use the right property to calculate the position of the object in the document, because the value of the right property is a string.

For more information about how to access the dimension and location of objects on the page through the DHTML Object Model, see Measuring Element Dimension and Location with CSSOM in Internet Explorer 9.

Examples

The following example uses the right property to change the position of the yellow div. In the example below, there are four div elements with absolute positioning. The yellow div is positioned at 35% from the right.

Code example: http://samples.msdn.microsoft.com/workshop/samples/css/positioning/positioning.html



#yellow {
   height: 175px;
   width: 175px;   
   background-color: #FFB900;
   position: absolute;
   right: 35%;
}


See also

CSSStyleDeclaration
currentStyle
LayoutRect
runtimeStyle
style

 

 

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.