Fade text too long inside HTML element

老子叫甜甜 提交于 2019-12-04 04:21:21

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.

This is similar to how "drop shadows" are created.

Edited to add:

I should have answered your list items directly.

  1. 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.

  2. Opacities don't fade.

  3. I don't know of a jQuery object that does this, but I haven't used it much.

Your solution 2. is indeed possible. You just have to use an absolutely-positioned element that has a linear-gradient background, from white to transparent.

No need for an image.

You can have a look at http://css-tricks.com/text-fade-read-more/

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!