Artigo Introdução de wulin.com (www.vevb.com): retângulos html5-canvas de desenho de tags.
<! Doctype html>
<html>
<head>
<meta charset = 'utf-8'>
<title> html5-canvas tag-retângulo </ititle>
</head>
<Body>
<Canvas ID = 1 largura = 200 altura = 200> </canvas>
<Script Type = Text/JavaScript>
window.onload = function () {
var canva = document.getElementById ('1')
Var Content = Canva.getContext ('2D')
content.fillstyle = #ccc; // preenche a cor de fundo da tela
content.fillRect (0, 0, 200, 200); // Os parâmetros representam o eixo x, y-eixo, largura e altura, respectivamente, respectivamente
Content.LineWidth = 4; // Largura da borda
content.strokestyle = #fff; // cor de borda
content.stracerect (50.50.100.100); // coordenadas e tamanhos de fronteira
content.fillstyle = #f00; // cor de preenchimento do retângulo
content.fillrect (50,50.100.100); // coordenadas e tamanho do retângulo
}
</script>
</body>
</html>