An element gets its width and height before being removed from the document stream. When you completely position the outer element, it is removed from the stream and, since it has no immediate content, it has a width of 0 and a height of 0. Therefore, another separation element inside it, trying to add text, inherits the parent width of 0, so it will expand to the width the longest word to allow content, and then break everything else into new lines. After that, it removes the item from the document stream, which disconnects by itself.
So, to answer your first question, yes , an absolutely positioned element pays attention to the dimensions of its parent element, unless you specify the width and / or height of the element itself. Do you know what should be the width of your children?
As for your second question ... you can use white-space: nowrap
. Not a good solution. It is more preferable to find the best way to organize your content so that you do not need three absolutely positioned elements nested in each other. You say you need to use them ... Really? Most likely, you simply did not find a better way to do this, but this is for another question, if you decide to go this way.
source share