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

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

问题描述

如果文本对于单元格来说太长,我想剪掉它并在末尾添加三个点..."(不换行).问题是,我不能只在 XX 符号后剪切 Java 中的内容,因为 '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.

我怎样才能用 CSS/java 实现这一点(如果没有 Java Script 可能的话)?还是不可能?

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

谢谢!

推荐答案

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

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

text-overflow: ellipsis;

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

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