I am new to css. I am wondering why when I change the positioning of the div element to absolute, the width of the div element changes? Tried it out in Chrome v25.0.1364.17
Because absolutely positioned elements do not behave as block level elements and do not flow after each other like normal a
does.You will need to set a width and a height for a div that is absolutely positioned, depending what it contains.
Your absolutely positioned element will position relative to the first parent element it is in. So, a simple example:
A simple 'gotcha' is not setting the parent element to have
position: relative;
I'm positioned absolutely to my parent.