This article mainly teaches you how to use HTML5CSS3 to draw a jagged rectangle and use the canvas label to draw a graph. For more information, see Html5 + Css3, share some things that you think are worth learning.
How to draw a jagged rectangle:
We know that canvas can be used to draw images. canvas is a new tag that appears in HTML5. It is used to draw images on webpages. H5 canvas uses Javascript to draw images on webpages.
The above jagged rectangle is drawn using canvas.
Implementation Code:
Copy XML/HTML Code to clipboard
-
-
-
-
- Sawtooth chart
-
-
-
-
-
-
-
-
How to write the following shape, a rectangle is divided into two parts, separated by a diagonal line, two colors.
At first it was such an idea. I used a p to draw a diagonal line in the middle and divide it into two parts, two colors, but they were not implemented. Due to the weak front-end and limited capabilities, I thought of another solution.
Using three p, there are two p on the left and right. Setting the width and height plays an important role in this part:
It is actually a rectangle, divided into two triangles, and finally achieved the above effect. In another way, it is so easy to implement, so it cannot be suspended on a tree.
The Code is as follows:
Copy XML/HTML Code to clipboard
-
-
-
-
-
-
-
-
-
In the future, I will continue to summarize some knowledge about HTML and CSS. The front-end knowledge looks simple, but it is actually a meticulous work that can train a person's patience. From Simplicity to complexity, from entry to depth, you can improve yourself a little bit.