How to make a div grow with content?

后端 未结 5 796
再見小時候
再見小時候 2021-02-05 01:40

Pertaining to html, how do I make a div container grow with the content instead of manually defining a width and height.

5条回答
  •  轮回少年
    2021-02-05 02:18

    Use the magical css property called "flex", it is really amazing

    yourDiv{
    display:flex;
    }
    

    Just make sure that the children are not position: absolute because this will not work with flex.

提交回复
热议问题