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 { 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 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