Use css properties to draw a Christmas tree, and css properties for the Christmas tree

Source: Internet
Author: User

Use css properties to draw a Christmas tree, and css properties for the Christmas tree



Css is essential for learning the front-end shoes. Today, we will use css to draw a Christmas tree.

The main exercise is the border practice and mastery in css.

Create a main area in the body <div> </div>:The triangle built with border is in the main area.

Change the background color of the main area:You can set a height.


Create the first triangle:


Each area represents a rectangle, and then the triangle is obtained by modifying the rectangle.

Modify the css attribute to get the triangle:

The width and height here are actually the length of the border on the inner side, and then respectively set the attributes of the upper and lower sides of the border, and use transparent to hide the border that does not need to be displayed.

Then use the div area as the trunk:

Final effect:



Related Article

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