How to dynamically increase the height of a
based on the contents?

后端 未结 4 1275
终归单人心
终归单人心 2021-01-20 11:52

I have a div on a page that I need to put content into. Sometimes the content is a few lines high, and sometimes the content is more than the screen height with varying size

4条回答
  •  情话喂你
    2021-01-20 12:02

    Don't specify a height, and the div will automatically resize with the contents.

    If you need a minimum size, there is a CSS property called min-height that sets the minimum height of the div.

提交回复
热议问题