CSS: The incredible border property

Source: Internet
Author: User
Tags border color

Original: Magic of CSS Border property

Magic CSS Border Property

Translator: Dwqs

In CSS, there are many rules for its border property. For some things, such as triangles or other images, we still use images instead. But we don't need it now, we can use CSS to form some basic graphics, and I share some tips on this.

1, Positive triangle:

.triangle_up  { Span style= "COLOR: #0000ff" >height : 0px;   width : 0px;  border -bottom :  50px solid #006633;  border -left :   50px solid transparent;  border -right : 50px solid transparent; }  

2, Inverted triangle:

.triangle_down  { Span style= "COLOR: #0000ff" >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 demo (for demo convenience, change the source code): http://jsfiddle.net/rt8cjtwq/embedded/result/

6, Direction arrow (highlight effect, 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:
<DivClass= "Arrow">  <DivClass= "Triangle_right"></Div>  <DivClass= "Arrowline"></Div></Div><DivClass= "Arrow">  <DivClass= "Arrowline"></Div>  <DivClass= "Triangle_left"></Div></Div>
Effect:

7, make 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:
<Div class= "Delociouslogo">  <Div class= "TopLeft"></Div>  <Div class= "TopRight"></Div>  <Div class= "Bottomleft"></Div>  <Div class= "BottomRight"></Div></Div>

effect: (The border color of the upper left corner is white)

Recommended article: Relive Css:border properties


Next: 8 Useful PHP Security functions, do you know a few?

CSS: The incredible border property

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.