[英]JSF Datatable Cell - Cut text and replace with "..." if content too long
I would like to cut off a text if it is too long for the cell and add three dots "..." at the end (no wrapping).如果文本对于单元格来说太长,我想剪掉它并在末尾添加三个点“...”(不换行)。 The problem is, that I cant just cut the content in java after XX symbols because 'i' takes less space than 'W', which in turn would look silly.
问题是,我不能只在 XX 符号后剪切 java 中的内容,因为“i”占用的空间比“W”少,这反过来看起来很傻。
How can I achiev this (if possible without Java Script) with CSS/java?我怎样才能用 CSS/java 实现这一点(如果没有 Java Script 可能的话)? Or is that not possible?
或者那是不可能的?
Thanks!谢谢!
尝试 CSS:设置max-width
并指定text-overflow
:
text-overflow: ellipsis;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.