Transparent text with text-shadow in IE

后端 未结 4 1571
不思量自难忘°
不思量自难忘° 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:12

    You can trick IE by moving the real text out of the viewable area and adjust the text-shadow to compensate for the real text offset.

    Here's a demo - http://jsfiddle.net/495dZ/36/

    The basic principal:

    .shadow { 
        display:inline-block;
        color:#FFF; // the color will control the text-shadow color
        text-indent:-999px; // offsetting the "real" text
        text-shadow:999px 1px 3px; // fixing the offset of the text shadow
    }
    

    This will work in certain situations and will require a unique setup for each of those situations. (most likely to set the parent's overflow to hidden so the offset text won't be seen. also sometimes you would need to offset it to different directions, depending on the context)

提交回复
热议问题