Html-canvas-tag
提供:Dev Guides
HTML-<canvas>タグ
説明
HTML <canvas>タグは、スクリプトを使用してグラフィックス、アニメーションなどを描画するためのものです。
例
<!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>
これは、次の結果を生成します-
グローバル属性
このタグは、リンク:/html/html_attributes_reference [HTML属性リファレンス]で説明されているすべてのグローバル属性をサポートします
特定の属性
HTML <canvas>タグは、次の追加属性もサポートしています-
Attribute | Value | Description |
---|---|---|
height html-5 | pixels | Specifies height of the canvas. |
width html-5 | pixels | Specifies width of the canvas. |
イベント属性
このタグは、link:/html/html_events_reference [HTMLイベントリファレンス]で説明されているすべてのイベント属性をサポートしています。
ブラウザのサポート
Chrome | Firefox | IE | Opera | Safari | Android |
---|---|---|---|---|---|
Yes | Yes | Yes | Yes | Yes | ? |