Is it possible to implement the effect of overflow:ellipsis with javascript or css?

前端 未结 2 765
迷失自我
迷失自我 2021-01-16 07:38

I want to show ... when overflow happens,

but sadly in css there is only overflow:hidden which is near but not exact what I wa

相关标签:
2条回答
  • 2021-01-16 08:10

    -moz-binding > firefox
    -o-text-overflow > opera
    text-overflow > ie + webkit (chrome/safari)

    0 讨论(0)
  • 2021-01-16 08:13
    text-overflow: ellipsis;
    

    See http://www.quirksmode.org/css/textoverflow.html and https://developer.mozilla.org/en/CSS/text-overflow. Doesn't support Firefox, however.


    Edit: There's a jQuery plugin for this. After you have installed it, call

    $(thatElement).ellipsis();
    

    to activate the style. See http://jsbin.com/acuti3. There are a bunch of other jQuery plugins for besides this.

    0 讨论(0)
提交回复
热议问题