Is there a way to change the color of the HTML5 element using CSS instead of JS? I need to customize qTips tooltip pointers using custom LESS CSS rules which I can't refer to using jQuery.
Asked
Active
Viewed 2.6k times
8
-
1PS. I tried setting the color, background-color and border declarations for the canvas in CSS but that didn't work, the background color is applied but the element is still showing up on top of it in a different color. – web_dvlp_sd Apr 18 '12 at 17:23
1 Answers
7
Yes, I don't know what the issue you are running into but I have a working jsfiddle here
<canvas></canvas>
canvas {
background: #cdcdcd;
width:200px;
height:200px;
}

John Kalberer
- 5,690
- 1
- 23
- 27
-
Thanks, it seems like it should work but I think it's getting over-ridden somehow by the default JS file. I tried applying "!important" to the CSS rules but that didn't do it either. – web_dvlp_sd Apr 18 '12 at 18:07
-
Ahh... If the js is rendering to it somehow, you need to change the initialization code so that it grabs the CSS background color and sets it. I am not sure what exactly the canvas js is doing so I can't help more. – John Kalberer Apr 18 '12 at 18:16