How do I only display part of a string using css

前端 未结 7 2122
梦谈多话
梦谈多话 2021-02-05 19:01

I want to be able to display a string of characters up to 10 characters. If the string goes over 10 characters, I\'d like to append \'...\' to the end.

For example, if

7条回答
  •  没有蜡笔的小新
    2021-02-05 19:44

    According to quirksmode, if there is a long text like

     
    11111111111111111111111111111111111111111111111111111111

    To wrap this you have many ways, use tag like below

     
    11111111111111111111111111111111111111111111111111111111

    It will be displayed like
    1111111111111111111111 1111111111111111111111 or use ­ instead of , output will be

     111111111111111111111-
     1111111111111111111111
    

    Or if you are looking for JS solution, then use this.

提交回复
热议问题