| <! DOCTYPE html> <meta charset= "UTF-8" > <script type= "Text/javascript" src= "/libs/jquery/1.4.4/jquery.min.js" ></script> <title> three methods of realizing triangle with pure CSS </title> <link rel= "stylesheet" > <style type= "Text/css" > . page-info {padding:8px 15px; background: #fcea9e; border-bottom:1px solid #b6bac0; Font:normal 16px Georgia;} . page-info h1 {float:left;} . page-info a {font-weight:bold; color: #222;} . return-article {Float:right} . return-article h2{Display:inline; /*border Simulation tips*/ . message-box {position:relative; float:left; margin:80px 0 0 100px; width:240px; height:60px; line-height:60px; Background: #E9FBE4; box-shadow:1px 2px 3px #E9FBE4; border:1px solid #C9E9C0; border-radius:4px; Text-align:center; Color: #0C7823; } . triangle-border {position:absolute; left:30px; overflow:hidden; width:0; height:0; border-width:10px; Border-style:solid dashed dashed dashed; } . tb-border {bottom:-20px Border-color: #C9E9C0 transparent transparent transparent;} . tb-background {bottom:-19px Border-color: #E9FBE4 transparent transparent transparent;} /* Character Simulation tips*/ . triangle-character {position:absolute; left:30px; overflow:hidden; width:26px; height:26px; font:normal 26px "Arial";} . tc-background {bottom:-12px; color: #E9FBE4;} . tc-border {bottom:-13px; color: #C9E9C0;} /*CSS3 Transfrom Simulation tips*/ . triangle-css3 {position:absolute; bottom:-8px; bottom:-6px; left:30px; overflow:hidden; width:13px; height:13px; Background: #E9FBE4; border-bottom:1px solid #C9E9C0; border-right:1px solid #C9E9C0;} . Transform {-webkit-transform:rotate (45deg);-moz-transform:rotate (45deg);-o-transform:rotate (45deg); Transform:rotate (45DEG); } /*ie7-9*/ . ie-transform-filter { -ms-filter: "Progid:DXImageTransform.Microsoft.Matrix (m11=0.7071067811865475, m12=-0.7071067811865477, m21= 0.7071067811865477, m22=0.7071067811865475, sizingmethod= ' auto expand ') "; Filter:progid:DXImageTransform.Microsoft.Matrix (m11=0.7071067811865475,m12=-0.7071067811865477, m21=0.7071067811865477,m22=0.7071067811865475,sizingmethod= ' Auto expand '); } </style> <body> <div class= "Message-box" > <span> I was implemented using the border attribute </span> <div class= "Triangle-border tb-border" ></div> <div class= "Triangle-border tb-background" ></div> </div> <div class= "Message-box" > <span> I was implemented using the character </span> <div class= "Triangle-character tc-border" > </div> <div class= "Triangle-character tc-background" > </div> </div> <div class= "Message-box" > <span> I was implemented using CSS Transfrom properties </span> <div class= "Triangle-css3 transform Ie-transform-filter" ></div> </div> </body>
|