CSS - right


Description

The left property is used in positioning an element. The right property allows you to specify how far the element is offset from the left of its containing block (for absolute positioning), or from the right of where the element itself would normally have been (for relative positioning).

Possible Values

  • length − A fixed distance from the right of the positioning context.

  • percent − Some percentage of the width of the positioning context, assuming that the width of the context has been set explicitly.

  • auto − Default. Lets the browser calculate the left position.

Applies to

All the HTML positioned element.

DOM Syntax

object.style.right = "2px";

Example

Here is the example which shows effect of this property −

<html>
   <head>
   </head>

   <body>
      <p style = "position:absolute; right:100px;">
         This line will be positioned 100px away from the right edge of this window.
      </p>
   </body>
</html> 

It will produce the following result −

Advertisements