CSS Layout questions

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 @chrisdavidmills :wink:

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.

1 Like

Super hyper extra clear Chris! :wink: