canvas

I. Description

The HTML canvas element is used to draw images with javascript or render graphics with the WebGL API.

II. Examples

<!DOCTYPE html>
<html>
    <head>
        <title>Example Page</title>
        <style>
            body canvas {
                height: 200px;
                width: 200px;
                background-color: white;
            }
        </style>
        <script>
            window.addEventListener("load", (event) => {
                var canvas = document.getElementById("example_canvas");
                var context = canvas.getContext("2d");
                context.fillStyle = "red";
                context.fillRect(20, 20, 180, 180);
            });
        </script>
    </head>
    <body>
        <h1>Using A Canvas To Draw A Rectangle</h1>
        <canvas id="example_canvas"></canvas>
    </body>
</html>