How to unset CSS text-shadow using JavaScript? - Stack Overflow

I use JavaScript to set the CSS text-shadow property. Here is my code to set the text-shadow property:v

I use JavaScript to set the CSS text-shadow property. Here is my code to set the text-shadow property:

var text = document.getElementById("text");
text.style.textShadow = "1px 1px 0 red";

Once I set it, how do I unset the CSS text-shadow property using JavaScript? I tried

text.style.textShadow = "0 0 0 0";

but it does not work.

I use JavaScript to set the CSS text-shadow property. Here is my code to set the text-shadow property:

var text = document.getElementById("text");
text.style.textShadow = "1px 1px 0 red";

Once I set it, how do I unset the CSS text-shadow property using JavaScript? I tried

text.style.textShadow = "0 0 0 0";

but it does not work.

Share Improve this question edited Feb 26, 2016 at 22:22 gariepy 3,6846 gold badges23 silver badges34 bronze badges asked Dec 7, 2011 at 5:56 user774411user774411 1,8156 gold badges29 silver badges47 bronze badges
Add a ment  | 

3 Answers 3

Reset to default 4
text.style.textShadow = "none";

Or, depending on your needs:

text.style.textShadow = "inherit";

Try:

text.style.textShadow = "none";

In fact, playing around with this, setting it to "0 0", null, and "" all seem to work as well.

See working test: http://jsfiddle/YwPF9/

I think

text.style.textShadow = "0 0";

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745574726a4633893.html

相关推荐

  • How to unset CSS text-shadow using JavaScript? - Stack Overflow

    I use JavaScript to set the CSS text-shadow property. Here is my code to set the text-shadow property:v

    6小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信