max-width adjusts to fit text?

后端 未结 4 1075
[愿得一人]
[愿得一人] 2020-12-03 16:55

Not the best title, but anyway...

I have an element with a max-width and some text.

If the text is longer than will fit on one line, I get this:

4条回答
  •  时光取名叫无心
    2020-12-03 17:49

    Not Possible by CSS Alone

    According to BoltClock in this answer, it is not possible. The explanation makes sense. For the line wrap to occur to begin with, the line needs to reach the max-width setting. Once done, it wraps, but it does not reshrink because it is using that size for the calculation of the wrap.

    As far as I know, this is still not possible.

提交回复
热议问题