How to use CSS to achieve a small triangle effect:
Recommended : As much as possible handwriting code, can effectively improve the learning efficiency and depth.
In a number of Web page effects, there are small triangle effect of the application, can increase the aesthetics of a particular application, the following gives an example code, which introduces two ways to achieve the small triangular head effect. The code is as follows:
<!DOCTYPE HTML><HTML><Head><Metahttp-equiv= "Content-type"content= "text/html; charset=utf-8" /><Metaname= "Author"content= "http://www.softwhy.com/" /><title>Three ways to implement triangles with pure CSS</title><styletype= "Text/css">. Message-box{position:relative;float: Left;margin:80px 0 0 100px;width:240px;Height:60px;Line-height:60px;Border:1px solid #000;text-align:Center;Color:#0C7823;}. Triangle-border{position:Absolute; Left:100px;Overflow:Hidden;width:0;Height:0;Border-width:10px;Border-style:None dashed solid dashed;}. Tb-border{Top:-10px;Border-color:#000 Transparent #000 transparent;}. Tb-background{Top:-9px;Border-color:transparent transparent #fff transparent;}/*character*/. Triangle-character{position:Absolute; Left:100px;Overflow:Hidden;width:26px;Height:26px;Font:normal 26px "song Body";}. Tc-background{Top:-12px;Color:#FFF;}. Tc-border{Top:-13px;Color:#000;}</style></Head><Body><Divclass= "Message-box"> <span>Border Property Implementation</span> <Divclass= "Triangle-border tb-border"></Div> <Divclass= "Triangle-border tb-background"></Div></Div><Divclass= "Message-box"> <span>Character implementations</span> <Divclass= "Triangle-character tc-border"></Div> <Divclass= "Triangle-character tc-background"></Div></Div></Body></HTML>
The original address is: http://www.softwhy.com/forum.php?mod=viewthread&tid=4586
For more information, refer to: http://www.softwhy.com/divcss/
How to use CSS to achieve a small triangle effect