CSS/Properties/right

From W3C Wiki
Jump to: navigation, search

right

The right property specifies how far positioned box's right margin edge is.

Description

Values <length> | <percentage> | auto | inherit
Initial value auto
Applies to positioned elements
Inherited No


Point, Note

  • For absolutely positioned elements
    This property specifies the distance between the right margin edge of the element and the right edge of its containing block.


  • For relatively positioned elements
    This property specifies the offset is with respect to the right edges of the box itself.


Values

  • <length>
    The offset is a fixed distance from the reference edge. Negative values are allowed.


  • <percentage>
    The offset is a percentage of the containing block's height. Negative values are allowed.


  • auto


  • inherit
    Takes the same specified value as the property for the element's parent.


Example

Example A

[style.css]

 p{
   background-color: #999;
   width: 300px;
   position: absolute;
   bottom: 25px;
   right: 50px;
 }

[index.html]

<body>
  <p>This is a paragraph.</p>
</body>

Csslist2 top.png

CSS Reference

The CSS specification defines the right property in 9.3.2 Box offsets.