Drawing color filled rectangle with Canvas Example

<!DOCTYPE html>
		<title>Drawing color filled rectangle with Canvas Example</title>
		<meta charset="utf-8">
		<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
			$(document).ready(function() {
				var canvas = document.getElementById("myCanvas");
				var ctx = canvas.getContext("2d");
				ctx.fillStyle = "rgb(255, 0, 0)";  //red
				ctx.fillRect(50, 50, 100, 100);  
		<canvas id="myCanvas" width="500" height="500">
			<!-- Insert fallback content here -->

Enjoyed this post? Share it!


Leave a comment

Your email address will not be published.