CSS: Incredible border attributes

Source: Internet
Author: User

CSS: Incredible border attributes

 

In CSS, the border attribute has many rules. For some things, such as triangles or other images, we still use images instead. But now we don't need it. We can use CSS to form some basic graphics. I 've shared some tips on this.

1. Triangle:

.triangle_up{  height:0px; width:0px;  border-bottom:50px solid #006633;  border-left:50px solid transparent;  border-right:50px solid transparent;}

 

2. Inverted triangle:

.triangle_down{  height:0px; width:0px;  border-top:50px solid #006633;  border-left:50px solid transparent;  border-right:50px solid transparent;}

 

3. Left triangle

.triangle_left{  height:0px; width:0px;  border-left:50px solid #006633;  border-top:50px solid transparent;  border-bottom:50px solid transparent;  float:left;}

 

4. Right Triangle

.triangle_right{  height:0px; width:0px; float:left;  border-right:50px solid #006633;  border-top:50px solid transparent;  border-bottom:50px solid transparent;}

 

5. Cross-street Effect

.crossSquare{  height:0px; width:0px;  border-right:50px solid blue;  border-top:50px solid gray;  border-bottom:50px solid red;  border-left:50px solid yellow;}

 

1 to 5 demo (for the convenience of the demo, the source code changed a bit): http://jsfiddle.net/rt8cjtwq/embedded/result/

 

6. Direction arrow (highlighted, changed the source code)

CSS:

.triangle_left{  height:0px; width:0px;  border-left:50px solid #006633;  border-top:50px solid transparent;  border-bottom:50px solid transparent;  /*float:left;*/}.triangle_right{  height:0px; width:0px; /*float:left;*/  border-right:50px solid #006633;  border-top:50px solid transparent;  border-bottom:50px solid transparent;}
HTML:
Effect: 

 

7. Create a Delicious Logo: CSS:
.delociousLogo {   height:100px; width:100px; } .topleft {   height:0px; width:0px;   border-top:50px solid #FFFFFF;   border-right:0px solid #FFFFFF;   border-bottom:0px solid #FFFFFF;   border-left:50px solid #FFFFFF;   float:left; } .topright {   float:left;   height:0px; width:0px;   border-top:50px solid #0000CC;   border-right:0px solid #0000CC;   border-bottom:0px solid #0000CC;   border-left:50px solid #0000CC; } .bottomleft {   float:left;   height:0px; width:0px;   border-top:50px solid #000000;   border-right:0px solid #000000;   border-bottom:0px solid #000000;   border-left:50px solid #000000; } .bottomright {   float:left;   height:0px; width:0px;   border-top:50px solid #999999;   border-right:0px solid #999999;   border-bottom:0px solid #999999;   border-left:50px solid #999999; }

 

HTML:
 

 

Effect: (the border color in the upper left corner is white)

 

Recommended article: Review CSS: Border attributes

 

Next article: How many of the eight useful PHP security functions do you know?

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