Reputation: 5561
I want to implement the textshadow
in my text, placed in a <a href="#">
, I am doing something like this:
document.getElementById("text").style.textShadow("1px 1px 0 red");
document.getElementById("text").style.moztextshadow("1px 1px 0 red");
document.getElementById("text").style.webkittextshadow("1px 1px 0 red");
None of the above implementations work. Am I making some kind of mistake? Thanks!
Upvotes: 2
Views: 4643
Reputation: 91094
Try this on this stackoverflow page:
document.getElementById('question-header').style.textShadow = '2px 2px 0 cyan';
edit: This seems to work on webkit browsers. Units are normally required, but not with 0. To debug, you can print out values for document.getElementById('text'), then that.style.
Upvotes: 2
Reputation: 15867
element.style["text-shadow"] = '1px 1px 5px red';
element.style.*
is not a function, it's a
value.text-shadow
. Giving 0 will give no blur-shadow to the text, more like a drop shadow.Upvotes: 1
Reputation: 35830
var text = document.getElementById("text");
text.style.textShadow = "1px 1px 0 red";
text.style.mozTextShadow = "1px 1px 0 red";
text.style.webkitTextShadow = "1px 1px 0 red";
Upvotes: 1