There is a parent block with position:relative which contains a child block with position: absolute . Is it possible to stretch the parent to the height of the child with CSS?

    1 answer 1

    CSS cannot be done with this, since their interconnection is not physical, this problem can be solved by JS:

     <div class='first'> <div class='second'> </div> 

     $(".first").height($(".second").height()); $(".first").width($(".second").width()); 
    • Is it possible to stretch the parent to the height of the child with CSS? (c) Cut out a question. From what the answer should follow: No, it is impossible to make it by means of css. - NeedHate