CSS and CSS3 implementations to draw a triangular element

Source: Internet
Author: User
This article mainly introduces the CSS and CSS3 implementation of the triangle elements, has a certain reference value, now share to everyone, the need for friends can refer to

The front-end page occasionally need to have triangle icon or triangle style, now the icon of the triangle mostly with the font icon to achieve, but some large triangular module still need to use the front-end CSS style to draw out, the following introduction of various angles of the triangle CSS style code, hope to bring help to everyone

1:triangle-up

#triangle-up {    width:0;    height:0;    border-left:50px solid transparent;    border-right:50px solid transparent;    border-bottom:100px solid Red;}

2:triangle-down

#triangle-down {    width:0;    height:0;    border-left:50px solid transparent;    border-right:50px solid transparent;    border-top:100px solid Red;}

3:triangle-left

#triangle-left {    width:0;    height:0;    border-top:50px solid transparent;    border-right:100px solid red;    border-bottom:50px solid Transparent;}

4:triangle-right

#triangle-right {    width:0;    height:0;    border-top:50px solid transparent;    border-left:100px solid red;    border-bottom:50px solid Transparent;}

5::triangle-topleft

#triangle-topleft {    width:0;    height:0;    border-top:100px solid red;    border-right:100px solid Transparent;}

6:triangle-topright

#triangle-topright {    width:0;    height:0;    border-top:100px solid red;    border-left:100px solid Transparent; }

7:triangle-bottomleft

#triangle-bottomleft {    width:0;    height:0;    border-bottom:100px solid red;    border-right:100px solid Transparent;}

8:triangle-bottomright:

#triangle-bottomright {    width:0;    height:0;    border-bottom:100px solid red;    border-left:100px solid Transparent;}

The above is the entire content of this article, more relevant content please pay attention to topic.alibabacloud.com.

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.