CSS Layout questions


(Mauro Di Bert) #1

Hi Chris! I’m in the CSS Layout part of the course and didn’t understad why the p element gets shorter when it’s in an absolute position. Look at the example from the course:

Thanks @chrismills :wink:


"Mozilla splash page" assessment
(Chris Mills) #2

Hi Mauro!

This is because when it is not positioned, it spans 100% of the width of its parent element (body) by default. But it has no specific width set on it.

When you absolutely position it, it is removed from the document flow, and therefore isn’t sized in relation to anything. In this case it is sized relative to the size of its content.

does that make sense, or do you still need more? I ought to update the docs to cover it too, maybe?

Best regards.


(Mauro Di Bert) #3

Super hyper extra clear Chris! :wink: