CSS right property

Description

CSS right property represents the distance of right side of current box either from the right side of parent box or from the original position depending upon the value of position property.


The current element should have position property otherwise right property will not work. We apply position:absolute; property to the current element.

Syntax

right : auto | length | percentage

Property values

autoDefault

It does not replace the current box.

right: auto;

length

It represents the distance of the right side of the current box from the right side of the parent box.

The box is 100px away from the right side of the parent box (absolute position).

right: 100px;

percentage

Actually percentage represents height of the parent box.

The box is 20% away from the right side of the parent box (absolute position).

right: 20%;

Applicable to

It applies to all elements

#CSS digger
Was this article helpful?

 
The current element should have position property otherwise right property will not work.
×

Ctrl+D