Absolute and Relative Positioning
- December 4th, 2008
- Posted in CSS
- Write comment
With the Absolute position you can position the page element anywhere in the parent element. You can control them the way you want. And much more control if the parent element is relatively positioned.
Let’s just assume that the box with dashed border is your browser window. This is what is looks like if the position on the parent element is set to default:

And this, if the position on parent element is set to relative:

The explanation to the images above is that when the element is set to absolute position, it position itself with respect to the parent element(Image 2). But when the parent element is not relatively position, it position itself to the body element ignoring the parent element(Image 1).
So what happens when the #child_element_1 is set to default position(static) and the sibling is set to absolute position? See the image below:

As you can see in the image above, while the #child_element_1‘s height is increasing the #parent_element‘s height will increase too but not with the #child_element_2‘s height. It’s because when the element is set to absolute position, that element is remove from the normal flow.
Hope this will help. Cheers!

Facebook
Linkedin
Virb
Flickr
Deviantart
Last FM
Delicious
Roboto
Tumblr
Twitter
Gtalk
Aim
Skype
Email

It’s nice to see you having posts like this.
with very well visuals for visitors too! keep it up.
It’s great to see a visually informative post about CSS positioning.
This will help beginners on understanding how div elements behave with different settings for the position property.
One suggestion though is try not to have your introduction as straightforward as that. Since your site isn’t purely a CSS tutorial site. Visitors without any knowledge about CSS will have no idea on what you’re talking about. So, at least tell something about CSS just a little bit.
Thank you. I’m not good at making introduction but I’ll try.