Home > Web Front-end > HTML Tutorial > The function of HTML tag

The function of HTML tag

(*-*)浩
Release: 2019-12-09 14:20:52
Original
2814 people have browsed it

HTML tag

The function of HTML <canvas> tag

##Internet Explorer 9, Firefox, Opera, Chrome and Safari support the tag .

Note: Internet Explorer 8 and earlier versions do not support the tag. (Recommended learning: html tutorial)

Definition and usage

tag defines graphics, such as charts and other images.

tags are just graphics containers, you have to use a script to draw the graphics.

Differences between HTML 4.01 and HTML 5

The tag is a new tag in HTML 5.

Example

How to display a red rectangle through the canvas element:

<!DOCTYPE HTML>
<html>
<body>

<canvas id="myCanvas">your browser does not support the canvas tag </canvas>

<script type="text/javascript">

var canvas=document.getElementById(&#39;myCanvas&#39;);
var ctx=canvas.getContext(&#39;2d&#39;);
ctx.fillStyle=&#39;#FF0000&#39;;
ctx.fillRect(0,0,80,100);

</script>

</body>
</html>
Copy after login

The above is the detailed content of The function of HTML tag. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template