Make Triangle shape over a div - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Shape

Description

Make Triangle shape over a div

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <style id="compiled-css" type="text/css">
div {<!--from  w ww . j a  v  a 2  s .  c om-->
   width:121px;
   height:100px;
   background:Chartreuse;
   color:yellow;
   position:relative;
   margin:21px;
   overflow:hidden;
}

div:before {
   content:'\161';
   width:0px;
   height:0px;
   border:61px solid blue;
   border-top:100px solid pink;
   position:absolute;
   top:0px;
   left:-61px;
}

div:after {
   content:'\161';
   width:0px;
   height:0px;
   border:61px solid OrangeRed;
   border-top:100px solid grey;
   position:absolute;
   top:0px;
   left:61px;
}
</style> 
 </head> 
 <body> 
  <div>
    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi ullamcorper molestie lacus s 
  </div>  
 </body>
</html>

Related Tutorials