Drawing using the canvas tag

<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>Drawing with canvas tag</title>
	</head>
	<body>
		<canvas id="MyCanvas">your browser does not support the canvas tag </canvas>
		<script type="text/javascript">
			var canvas = document.getElementById("MyCanvas");
			var ctx = canvas.getContext('2d');
			ctx.fillStyle='#FF0000';
			ctx.fillRect(0,0,100,100);/*The result is a red square with a side length of 100px*/
		</script>
	</body>
</html>

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325159970&siteId=291194637