How to make a div grow with content?

后端 未结 5 733
再見小時候
再見小時候 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条回答
  •  旧时难觅i
    2021-02-05 02:00

    You can specify min-width and min-height and DIV will adjust width / height as the content changes (of course, not below min width/height).

    Working code pen example

    Most important css properties from the code (DIV is editable, so just type in text and it will grow with it by width / height):

     min-height: 200px;
      min-width: 100px;
    

提交回复
热议问题