$(document).ready(function() { var canvas = $("#myCanvas").get(0); var context = canvas.getContext("2d"); function renderContent() { context.lineWidth = 5; context.lineCap = "round"; context.lineJoin = "round"; context.moveTo(50, 50); context.bezierCurveTo(50, 50, 150, 50, 150, 150); //context.lineTo(150, 150); context.lineTo(150, 50); context.lineTo(50, 50); context.stroke(); context.fillStyle = "#F00"; context.fill(); context.lineWidth = 1; context.strokeText("Hello, Canvas!", 50, 150); } renderContent(); });
<canvas id="myCanvas" width="500" height="500"> <p>Canvas not supported.</p> </canvas>
body { background-color: #00F; }