value: <length> | <percentage> | auto | inherit
initial value: 0
inherited: no
percentages: refer to width of positioned containing block
applicable to: positioned elements

The CSS property of right can be used with any element, but will only take effect if the element has been positioned as relative, absolute or fixed. Giving an element a left property and value will not effect it if there is no positioning or if it has the positioning of static. Its value refers to the distance from the right edge of the containing element. The default value for a positioned element is 0 pixels from the left edge and 0 pixels from the top edge of the containing element.

The right property can be assigned a value in a fixed number of pixels, em or a percentage. The percentage will be that of the width of the containing element.

Some things to know about elements that have an absolute or fixed property is that they do not go with the normal flow of the formatting. The will sit in the same location relative to their containing element. The property of z-index will apply only for positioned elements.

Along with the right property, you can also have a top or bottom property for positioned elements. Instead of the left property, you can express the position with the left property for the distance from the left edge of the containing element.


div#outerbox {position: relative;}
.innerbox {position: absolute; top: 30px; right: 30px;}