Draw a triangle arrow pattern with pure CCS and draw a triangle with ccs

Source: Internet
Author: User

Draw a triangle arrow pattern with pure CCS and draw a triangle with ccs

Draw a triangle arrow with CSS. With pure CSS, you only need a small amount of code to create triangle arrows compatible with various browsers!

 

CSS code:
/* create an arrow that points up */div.arrow-up {width: 0; height: 0; border-left: 5px solid transparent;  /* left arrow slant */border-right: 5px solid transparent; /* right arrow slant */border-bottom: 5px solid #2f2f2f; /* bottom, add background color here */font-size: 0;line-height: 0;}/* create an arrow that points down */div.arrow-down {width: 0; height: 0; border-left: 5px solid transparent;border-right: 5px solid transparent;border-top: 5px solid #2f2f2f;font-size: 0;line-height: 0;}/* create an arrow that points left */div.arrow-left {width: 0; height: 0; border-bottom: 5px solid transparent;  /* left arrow slant */border-top: 5px solid transparent; /* right arrow slant */border-right: 5px solid #2f2f2f; /* bottom, add background color here */font-size: 0;line-height: 0;}/* create an arrow that points right */div.arrow-right {width: 0; height: 0; border-bottom: 5px solid transparent;  /* left arrow slant */border-top: 5px solid transparent; /* right arrow slant */border-left: 5px solid #2f2f2f; /* bottom, add background color here */font-size: 0;line-height: 0;}

The key to drawing these triangles is that you need to make the two sides in the direction pointed by the arrow have a very thick border. The side of the arrow is the same thick border, and the color of this side is the color of your triangle. The thicker the border, the larger the triangle. In this way, you can draw arrows of various colors, sizes, and orientations. The best thing is that you only need a few lines of CSS code to achieve this effect.

 

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.