Multiline text to fit parent container in React JS

前端 未结 4 2219
情歌与酒
情歌与酒 2021-02-19 19:51

I am using a flexbox layout and am trying to get the text in a specific div to be resized to fit that div.

So for example, if I have code as follows:

&l         


        
4条回答
  •  灰色年华
    2021-02-19 20:43

    I am not a reactJs user but I have worked with CSS flex

    you can set height of the container to auto so that it changes as we get the content. Also, you should set min-height and max-height properties in css so that if content is less that given length, it appears on min-height and if the content is way to big, it does not exceed the given container height.

    In order to disallow content from getting out of the box, you can use overflow:hidden. this will keep the content from getting out of the box.

    Hope this gives some help with how you want to proceed.

提交回复
热议问题