Limit characters displayed in span

后端 未结 7 2311
清歌不尽
清歌不尽 2020-12-13 06:36

Is there some sort of way within HTML or CSS to limit the characters displayed with a span? I use a repeater that displays these info boxes and I want to limit the character

7条回答
  •  长情又很酷
    2020-12-13 07:08

    Yes, sort of.

    You can explicitly size a container using units relative to font-size:

    • 1em = 'the horizontal width of the letter m'
    • 1ex = 'the vertical height of the letter x'
    • 1ch = 'the horizontal width of the number 0'

    In addition you can use a few CSS properties such as overflow:hidden; white-space:nowrap; text-overflow:ellipsis; to help limit the number as well.

提交回复
热议问题