Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change <canvas> color using CSS?

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.

like image 680
web_dvlp_sd Avatar asked Apr 18 '12 17:04

web_dvlp_sd


People also ask

How do I change the color of my canvas?

Set the Canvas Color ThemeOn the Canvas menu bar, choose File > Settings. In the General section of the page, click the drop-down menu next to Canvas theme, and choose a color: Dark, Light, or Blue. After a few seconds the color theme for the entire Canvas development environment will change to the selected theme.

Can you style canvas with CSS?

Because the canvas is an HTML element, you can use CSS styles to modify its position, assign it a background color or image, add a border, and so on. In Safari and other WebKit-based browsers, you can use WebKit transitions to smoothly animate changes in CSS properties.

Can I change canvas background color?

To change the Canvas color (The area outside of a document's boundaries), Right-clicking anywhere on the canvas and select any shade of gray that you like (from Black to Light Gray). To select any other color choose “Select Custom Color…“.


1 Answers

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;
}​
like image 68
John Kalberer Avatar answered Sep 22 '22 14:09

John Kalberer