<!DOCTYPE html> | |
<html> | |
<head> | |
<script> | |
function start() { | |
var canvas = document.getElementById("cnv"); | |
var ctx = canvas.getContext("2d"); | |
ctx.fillStyle = "#ff0000"; | |
ctx.fillRect(0, 0, canvas.width, canvas.height); | |
} | |
</script> | |
</head> | |
<body onload="start()"> | |
<div id="box" style="position: absolute; width: 300px; height: 200px; border-radius: 40px; overflow: hidden;"> | |
<canvas id="cnv" width="400px" height="400px"></canvas> | |
</div> | |
</body> | |
</html> | |