5. Demonstration of CSS Positioning: Absolute and Relative.


    <!DOCTYPE html>
    <html>
    <head>
      <style>
        div.relative {
          position: relative;
          width: 400px;
          height: 200px;
          border: 3px solid #73AD21;
        }
        
        div.absolute {
          position: absolute;
          top: 80px;
          right: 0;
          width: 200px;
          height: 100px;
          border: 3px solid #73AD21;
        }
      </style>
    </head>
    <body>
      <h2>position: absolute with relative;</h2>
      <div class="relative">This div element has position: relative;
        <div class="absolute">This div element has position: absolute;</div>
      </div>
    </body>
    </html>
    

Output

        No Output Available