Pure CSS Implementation triangles

Source: Internet
Author: User

In the design of the interface, usually need a triangle icon, the general practice is to use the picture, in fact, you can also use CSS to achieve. As follows:

Upward triangle

Triangle to the right

Downward triangle

Triangle to the left

The CSS that implements them are:

 1  .top  { 2   width :  0 ; 3   height :  0 ; 4   Border-color :  transparent transparent #333 transparent ; 5   Border-width :  6px ; 6   Border-style :  solid ; 7 } 
 1  .right  { 2   width :  0 ; 3   height :  0 ; 4   Border-color :  transparent transparent transparent #333 ; 5   Border-width :  6px ; 6   Border-style :  solid ; 7 } 
 1  .down  { 2   width :  0 ; 3   height :  0 ; 4   Border-color :  #333 transparent transparent transparent ; 5   Border-width :  6px ; 6   Border-style :  solid ; 7 } 
 1  .left  { 2   width :  0 ; 3   height :  0 ; 4   Border-color :  transparent #333 transparent transparent ; 5   Border-width :  6px ; 6   Border-style :  solid ; 7 } 

the border-color:transparent used in it is only not supported, so you can use it with confidence

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.