How to use CSS to achieve a small triangle effect

Source: Internet
Author: User

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

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.