JSF Datatable Cell - 剪切文本并替换为“...”如果内容太长 [英] JSF Datatable Cell - Cut text and replace with "..." if content too long

查看:165
本文介绍了JSF Datatable Cell - 剪切文本并替换为“...”如果内容太长的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果对于单元格太长,我想要截断一个文本,并在结尾添加三个点...(无包装)。问题是,我不能只剪切在XX XX符号后的内容,因为'i'比'W'更少的空间,这反过来会看起来很傻。

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.

如何实现这个(如果可能没有Java脚本)与CSS / java?
或者是不可能的?

How can I achiev this (if possible without Java Script) with CSS/java? Or is that not possible?

谢谢!

推荐答案

p>尝试CSS:设置 max-width 并指定 text-overflow

Try CSS: Set a max-width and specify text-overflow with:

text-overflow: ellipsis;

这篇关于JSF Datatable Cell - 剪切文本并替换为“...”如果内容太长的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆