Center triangle at bottom of div full width responsively - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:UL

Description

Center triangle at bottom of div full width responsively

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">
html, body {
   padding:0;
   margin:0;
}

.top {
   background-color:Chartreuse;
   height:100px;
   width:100%;
   position:relative;
}

.bottom {
   background-color:yellow;
   height:201px;
   width:100%;
}

.triangle {<!--  ww  w . j a  v a 2 s .  co  m-->
   border-top:41px solid blue;
   border-left:51vw solid pink;
   border-right:51vw solid OrangeRed;
   width:0;
   height:0;
   bottom:-41px;
   content:"";
   display:block;
   position:absolute;
   overflow:hidden;
   left:0;
   right:0;
   margin:auto;
}
</style> 
 </head> 
 <body> 
  <div class="top"> 
   <div class="triangle"></div> 
  </div> 
  <div class="bottom"></div>  
 </body>
</html>

Related Tutorials