Il tag HTML <canvas>



Descrizione

Il tag HTML <canvas> serve per disegnare grafici, animazioni, ecc utilizzando script.

Esempio

<!DOCTYPE html>
<html>
<head>
<title>HTML Canvas Tag</title>
</head>
<body>
<canvas id="newCanvas">Your browser does not support canvas tag.</canvas>
<script>
var c=document.getElementById('newCanvas');
var ctx=c.getContext('2d');
ctx.fillStyle='#00FD00';
ctx.fillRect(0,0,200,60);
</script>
</body>
</html>

Produrrà il seguente risultato:

Your browser does not support canvas tag.

Attributi Globali

Questo tag supporta tutti gli attributi globali descritti in - HTML - Referenze Attributi

Attributi Specifici

Il tag HTML <canvas> supporta anche i seguenti attributi aggiuntivi:

AttributoValoreDescrizione
height html-5pixelsDefinisce l' altezza del canvas.
width html-5pixelsDefinisce la larghezza del canvas.

Attributi Evento

Questo tag supporta tutti gli attributi evento descritti in - HTML - Referenze Eventi

Compatibilità Browser

ChromeFirefoxIEOperaSafariAndroid
SiSiSiSiSi?
html_tags_reference.htm
Advertisements