在HTML元素中,文字过长 [英] Fade text too long inside HTML element
问题描述
所以我的问题类似于:
http://stackoverflow.com/questions/3695435/crop-text-too-long-inside-div
什么是
所需的输出不会包含椭圆(...)但会褪去。所以如果我有类似的:
The desired output would not include an ellipses (...) but would "fade" away. So if I had something like:
<div class="text">This is the really long area of text that I want to chop</div>
然后在任何我决定,说中途在wa | nt ... n会褪色,并且t将几乎完全褪色。当然,定位是随机的,可以下降acroos 3或4个字母...
then at wherever I decide, say midway in wa|nt... the n would be half faded, and the t would be almost completely faded. Of course the positioning is random and could fall acroos 3 or 4 letters...
这里是可接受的解决方案按优先顺序。
Here are acceptable solutions in order of preference.
- 是否可以单独用css淡出文本?
- 如果无法使用div.text中的另一个元素,完成我想要的(可以不透明度褪色?)。
- 使用jQuery做它吗? (ugh ... not preferred)
推荐答案
假设您的网页背景为白色:一个gif从透明到白色(从左到右)。将其重叠在div的右侧。
Assuming your page-background is white: Make a gif with goes from transparent to white (left to right). Overlay this on the right side of the div. Your text will seem to fade to white.
这与创建阴影类似。
已编辑以添加:
我应该直接回答您的列表项。
I should have answered your list items directly.
-
不,不可能用CSS单独淡出文本,除非你逐个字符;
No, it is not possible to fadeout the text with CSS alone, unless you do it character-by-character; but that's almost impossible to control across different browsers and screen resolutions.
不透明度不会褪色。
我不知道有一个jQuery对象,但我没有使用它。
I don't know of a jQuery object that does this, but I haven't used it much.
这篇关于在HTML元素中,文字过长的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!