Creating transparent text to show gradient color of underlying div

前端 未结 6 1040
悲&欢浪女
悲&欢浪女 2021-01-13 16:53

I am trying to create gradient text with plain HTML and CSS. Something like the text below

Check the FIDDLE. It is self explanatory.

I know how to achieve th

6条回答
  •  说谎
    说谎 (楼主)
    2021-01-13 17:29

    Following trick will only work if your text/content is on solid background.

    I'm summarizing points from this blog post

    1. Put an empty span with in the text container, for eg.

      This this heading

      etc.
    2. Embed background-image [png] through css to this span
    3. And position it absolutely, upon the text.

    It works in IE6 onwards, but IE PNG hack is required!

    Hope it helps! :)

提交回复
热议问题