Right

The CSS right property specifies part of the position of positioned elements.

The right property is used to set the right margin edge of the element and the right edge of its containing block for absolute or fixed positioned elements. If position is selected "static", right property won't have any effect.

CSS Syntax

right: auto | length | initial | inherit;

Let's see an example:

<!DOCTYPE html>
<html>
   <head>
      <style>
           img {
                position: absolute;
                right: 25px;
           }
      </style>
   </head>
   <body>

      <img src="//www.w3docs.com/bundles/w3book/images/logo.png?v4" width="146" height="41">

   </body>
</html>

Let's see another example:

<!DOCTYPE html>
<html>
   <head>
      <style>
           div{
            height:150px;
            width:100%;
            background-color: #2d2d2d;
            color: #ffffff;
           }
           img {
                position: absolute;
                right: 150px;
                top:60px;
           }
      </style>
   </head>
   <body>

      <img src="//www.w3docs.com/bundles/w3book/images/logo.png?v4" width="146" height="41">
      <div> This is some div element.</div>

   </body>
</html>

Property Values

Value Descriptions
auto When we use this, the browser will set the left edge position. It is the default value of this property.
length It sets the left edge position with px, cm etc. and we can use negative values.
% It sets the left edge position with % of containing element. We can use negative values.
initial It makes the property use its default value.
inherit It inherits the property from its parents element.