CSS PROPERTIES
Expand All | Collapse All
CSS AT-RULES

CSS right Property

Topic: CSS3 Properties ReferencePrev|Next

Description

The right CSS property specify an offset for the right edge of the positioned element, relative to the right edge of the reference element's box or browser window.

  • For absolutely positioned elements, the right property specifies how far the right edge of the element's box is offset to the left of the right edge of its containing block.
  • For relatively positioned elements, the right property specifies the offset with respect to the right edge of the box itself (i.e., the box is given a position in the normal flow, and then offset from that position according to these properties).

The following table summarizes the usages context and the version history of this property.

Default value: auto
Applies to: Positioned elements
Inherited: No
Animatable: Yes. See animatable properties.
Version: CSS 2, 3

Syntax

The syntax of the property is given with:

right length | percentage | auto | initial | inherit

The example below shows the right property in action.

p {
    position: absolute;
    right: 150px;
}

Property Values

The following table describes the values of this property.

Value Description
length Specifies the offset as a length value in px, pt, cm, em, etc. Negative length values are allowed.
percentage Specifies the offset in percentage. The percentage is calculated with respect to the width of the element's containing block. Negative percentage values are allowed.
auto The browser calculates the right edge position. This is default value.
initial Sets this property to its default value.
inherit If specified, the associated element takes the computed value of its parent element right property.

Browser Compatibility

The right property is supported in all major modern browsers.

Browsers Icon

Basic Support—

  • Firefox 1+
  • Google Chrome 1+
  • Internet Explorer 4+
  • Apple Safari 1+
  • Opera 6+

Further Reading

See tutorial on: CSS Position, CSS Layers.

Related properties: position, top, left, bottom, z-index.

Bootstrap UI Design Templates Property Marvels - A Leading Real Estate Portal for Premium Properties