How to absolute position an element relative to a div?


An element with position:absolute will be positioned relative to entire page or relative closest positioned ancestor. Later part of last sentence is really helpful if you want to absolute position an element inside its parent block.

This is quite handy trick and once you have mastered basic CSS, Tricks like these will make you an experienced with CSS.Below code will position child-div in top right corner of parent-div.

Quick Tip

if you want absolute positioned div to fill its parent div use the following code and Child div will have same height and width as Parent Div.