Behold a canvas element !
A Pen by Eugenio Leon on CodePen.
Behold a canvas element !
A Pen by Eugenio Leon on CodePen.
| <canvas id="canvas-001"></canvas> |
| var canvas = document.getElementById("canvas-001"); | |
| var ctx = canvas.getContext("2d"); | |
| canvas.width = 800; | |
| canvas.height = 200; | |
| // color through fillstyle : | |
| ctx.fillStyle = "blue"; | |
| ctx.fillRect(0, 0, 600, 100); | |
| // Background Color through vanilla Js : | |
| document.getElementById("canvas-001").style.backgroundColor = "lightblue"; | |
| // Background Color through Jquery : | |
| //$("#canvas-001").css("background-color", "darkblue"); |
| <script src="https://code.jquery.com/jquery-2.2.4.min.js"></script> |
| /* #canvas-001{ | |
| background-color: blue; | |
| } */ |