是否有 Ruby truncate
的等价物CSS 中特定字符数的方法?
我一直在阅读有关组合不同 CSS 方法的文章,例如文本溢出:
Setting a max character length in css
但似乎没有直接的解决方案来在特定数量的字符后复制 truncate
功能,例如:
<%= truncate(this.thing, length: 15, separator: '...') %>
最佳答案
我确实找到了这个 css here :
white-space: nowrap;
width: 15em;
overflow: hidden;
text-overflow: ellipsis;
border: 1px solid #000000;
对于现代浏览器,它似乎可以满足您的期望。
关于html - CSS 中等效的 Ruby Truncate 方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44460151/