CSS Position Absolute

In CSS, the position property specifies how an element is positioned in the document flow. The value absolute tells the browser to position the element absolutely, relative to its nearest positioned ancestor. If there is no positioned ancestor, the element is positioned relative to the document body.

Here's how it works:

Try yourself
        
            .container {
    position: relative;
    width: 300px;
    height: 200px;
    border: 1px solid black;
}
  
.absolute-element {
    position: absolute;
    top: 50px;
    left: 50px;
    width: 100px;
    height: 100px;
    background-color: red;
}
        
    

Positioning Properties


position absolute