Can I use a gradient as the background to the canvas tag?

« Back to message list

Enter your email address to get email updates on this topic. You can stop receiving updates by clicking the link in the update email messages.

Posted by Pete Benes on 24th February 2014

is there a way to set the background to appear as a gradient? Something like this :

Posted by Richard on 24th February 2014
Hi there,

The easiest way would be to use CSS on the canvas tag:

canvas#cvs {
     background-color: rgba(248,248,248, 0.5);
     background: -webkit-gradient(linear, left top, left bottom, from(#eee), to(white));
     background: -moz-linear-gradient(top, #eee, white);
     background-image: linear-gradient( 0deg, white, #eee);
     filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#eeeeee', endColorstr='#ffffff');


Add a reply

« Back to message list