The forums ran from 2008-2020 and are now closed and viewable here as an archive.
Home › Forums › CSS › Make parent element expand vertically as much as its inner absolute element.
I think the question needs no extra explanation. But here’s a pen to demonstrate it better:
Pretty sure this isn’t going to have a CSS solution.
As I am sure you are aware, absolutely positioned elements are removed from the document flow and thus heights are ignored by ‘parent’ elements.
JS/JQ would be the simplest way forward.
Thanks Paulie. Kinda wanted to make sure, because we always find new techniques and hacks that we used to think aren’t possible with pure css. (i.e. centering in the unknown)
Problem here is you can’t even use a pseudo-element of your child element to fake an inline element in the parent since it has already been moved out of the flow.
I can’t see any CSS solution for this.