Is there a non javascript way to stretch an element either in relation to its parent (if the content is too short) or following the content. Here are three images to explain the topic:

This is a divpositioned absolute with top, bottom etc at 20px

This is the some situation with more content “breaking” the div which is not the way it should be.

You get the idea?
Sure, don’t
position: absolutethe inner div.Live Example