How to paint half of a letter or text in HTML(CSS)?

This question already has an answer here:

  • Is it possible to apply CSS to half of a character? 18 answers
  • CSS Display One Character in 2 Colors [duplicate] 2 answers

  • You can try it with gradients as Robbie suggested. There is only one down side of this. You won't be able to use text-shadow property (except with another hack - make duplicate of text and give it the shadow property)

    Edited on request...

    p {
      font-size: 12px;
      background: -webkit-linear-gradient(#000, #DDD);
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
    }
    

    Source code can be found here https://css-tricks.com/snippets/css/gradient-text/

    链接地址: http://www.djcxy.com/p/23784.html

    上一篇: 有没有办法用不同的颜色部分填充文本?

    下一篇: 如何在HTML(CSS)中绘制一个字母或文本的一半?