Transparent text with text-shadow in IE

后端 未结 4 1572
不思量自难忘°
不思量自难忘° 2021-01-18 20:56

When using color: rgba(255,255,255,0.0); in conjunction with text-shadow: 0px 0px 2px rgba(255,255,255,1);, Internet Explorer seems to inherit the

4条回答
  •  抹茶落季
    2021-01-18 21:10

    A extra text-shadow definition for IE 10+ do the trick:

    .transparent-text-with-shadow {
    
        color:         transparent;                            // or rgba(0,0,0,0);
        text-shadow:   rgba(0,0,0,1) 0px 0px 10px;             // for Chrome etc.
        text-shadow:   rgba(0,0,0,1) 0px 0px 10px 0.01em;      // for IE 10+
    }
    

    The second text-shadow definition overwrites the first in IE 10+ only, because IE 10+ supports a fourth length value for the shadow's "spread" - see http://caniuse.com/#search=text-shadow

    In other browsers, like Chrome, the second text-shadow definition overwrite fails, because they do not support a fourth length value for the shadow, and so they will use the first text-shadow definition.

    (Make sure the fourth "spread" value is very small - so you can't see any rendering differences.)

提交回复
热议问题