Do you know of a good solution for dealing with text entries of variable lengths lists with a fixed width?
您是否知道处理具有固定宽度的可变长度列表的文本条目的良好解决方案?
I have an unordered list with a set number of items. Each item contains a title. The title can be variable length, not only in number of characters, but also number of characterset (korean, japanese, roman, etc.).
我有一个包含一定数量项目的无序列表。每个项目都包含一个标题。标题可以是可变长度,不仅可以是字符数,还可以是字符数(韩语,日语,罗马等)。
One option seems to be cutting the text length down with PHP and adding "..." at the end, but since character widths can be variable, the exact cutoff can also be variable. Another would be to make items fixed with and hide overflow, but this seems inelegant (because characters might get cutoff right in their centers...).
一个选项似乎是用PHP缩短文本长度并在末尾添加“...”,但由于字符宽度可以变化,因此精确截止也可以变化。另一种方法是将物品固定并隐藏溢出,但这看起来不够优雅(因为人物可能会在他们的中心被切断......)。
Do you know of a good tutorial or solution for something like this?
你知道一个很好的教程或解决方案吗?
1 个解决方案
#1
3
Using CSS: text-overflow: ellipsis
. Doesn't work in all browsers though. More information: http://www.quirksmode.org/css/textoverflow.html.
使用CSS:文本溢出:省略号。但是在所有浏览器中都不起作用。更多信息:http://www.quirksmode.org/css/textoverflow.html。
#1
3
Using CSS: text-overflow: ellipsis
. Doesn't work in all browsers though. More information: http://www.quirksmode.org/css/textoverflow.html.
使用CSS:文本溢出:省略号。但是在所有浏览器中都不起作用。更多信息:http://www.quirksmode.org/css/textoverflow.html。