最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

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

programmeradmin14浏览0评论

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";
发布评论

评论列表(0)

  1. 暂无评论