CSS Positioning Example




CSS Positioning Example

<html>
   <head>
   </head>
   <body>
      <div style="position:relative;left:80px;top:2px;background-color:yellow;">
      This div has relative positioning.
      </div>
   </body>
</html>

Output

<html>
   <head>
   </head>
   <body>
      <div style="position:absolute; left:80px; top:20px; background-color:yellow;">
      This div has absolute positioning.
      </div>
   </body>
</html>

Output

<html>
   <head>
   </head>
   <body>
      <div style="position:fixed; left:80px; top:20px; background-color:yellow;">
      This div has fixed positioning.
      </div>
   </body>
</html>

Output