CSS responsive, Equilateral triangle - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Responsive Layout

Description

CSS responsive, Equilateral triangle

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">
h3 {<!--from   w  w w.  j ava2s .  c o m-->
   margin:11px;
   text-align:center;
}

.small-container {
   max-width:11%;
   float:left;
}

.medium-container {
   max-width:31%;
   float:left;
}

.large-container {
   float:left;
   max-width:51%;
}

.fancy-triangle {
   width:51%;
   height:0;
   padding-left:51%;
   padding-bottom:51%;
   overflow:hidden;
}

.fancy-triangle:after {
   content:"";
   display:block;
   width:0;
   height:0;
   margin-left:-501px;
   border-left:501px solid Chartreuse;
   border-right:501px solid yellow;
   border-bottom:501px solid blue;
}
</style> 
 </head> 
 <body> 
  <h3>Lorem ipsum dolor s</h3> 
  <div class="fancy-triangle"></div>  
 </body>
</html>

Related Tutorials