HTML5 + CSS3 creating a jagged rectangle _ html5 tutorial-

Source: Internet
Author: User
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

  1. 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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.