This article mainly introduces the canvas label in the HTML5 of the drawing, explains the HTML5 canvas label definition and basic use of the process, add a point CSS style and JS basic knowledge, make the whole article difficult to increase, but according to the code operation is always correct. Now let's take a look at this article.
First we talk about the meaning of the canvas label in HTML5:
<canvas> tags define graphs, tables and other images.
<canvas> tags are just graphics containers, and you can use canvas to draw paths, boxes, circles, characters, and add images in a variety of ways.
Now tell me how to use html5<canvas> to mark a drawing:
Most canvas drawing APIs are not defined on the <canvas> element itself, but rather on a "drawing environment" object obtained through the GetContext () method of the canvas.
The Canvas API also uses the notation of the path. However, the path is defined by a series of methods, rather than strings that are described as letters and numbers, such as calls to the Beginpath () and Arc () methods.
Once a path has been defined, other methods, such as fill (), are operations on this path. Various properties of the drawing environment, such as FillStyle, illustrate how these operations are used.
Note: The Canvas API is very compact for one reason that it does not provide any support for drawing text. To add text to a <canvas> graphic, you must either draw it yourself and merge it with a bitmap image, or overwrite the HTML text with CSS positioning above <canvas>.
Use of html5<canvas> Tags:
Define graphs, tables, and other images. However, the <canvas> tag is just a graphics container and you must use a script to draw the graphic. Labels typically need to specify an id attribute (often referenced in the script), the width and Height properties define the size of the canvas, and use the Style property to add a border.
For example, create a rectangle, a square.
<!doctype html>