Horje

Default CSS Settings For HTML <canvas> Tag

Most browsers will display the <canvas> element with the following default values:

index.html
Example: HTML
<style>
canvas {
  border:1px solid black;
}
</style>
<canvas id="myCanvas">Your browser does not support the HTML5 canvas tag.</canvas>
<script>
let c = document.getElementById("myCanvas");
let ctx = c.getContext("2d");
ctx.fillStyle = "#FF0000";
ctx.fillRect(0, 0, 80, 100);
</script>

Output should be:

Default CSS Settings For HTML <canvas> Tag




Type:
html
Category:
Web Tutorial
Sub Category:
HTML Tag
Uploaded by:
Admin