简体   繁体   中英

Dynamic text in fixed-size div

I have a fixed-size div with generated text inside it.

Is there some simple way to cut the text before div's end and add "..." at the end using DOJO or plain Javascript? Is there a way to do it regardless of what size of font i use?

The only way that comes to my mind is to calculate how many characters with actual font fits into my div and than cut the text to be that long, but this looks pretty lame :-) any suggestions?

可能对dojo.html.ellipsis有帮助

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM