Create hexagon shape - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Shape

Description

Create hexagon shape

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <title>Lorem ipsum dolor sit ame</title> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <style id="compiled-css" type="text/css">
.t div {<!--from   w  ww.j  a va  2  s .c om-->
   position:absolute;
   top:0;
   left:0;
   transform-origin:0 0;
   -ms-transform-origin:0 0;
   -webkit-transform-origin:0 0;
   transition:all 2s;
   -webkit-transition:all 2s;
   -moz-transition:all 2s;
}

.t .wrap {
   top:51%;
   left:51%;
   -ms-transform:skewX(31deg);
   -webkit-transform:skewX(31deg);
   transform:skewX(31deg);
}

.t .wrap .triangle {
   position:relative;
   width:201px;
   height:174px;
   background-color:Chartreuse;
   cursor:pointer;
   z-index:2;
}

.t .wrap .mask {
   width:100%;
   height:116.6%;
   background-color:yellow;
   left:100%;
   z-index:3;
   -ms-transform:skewX(-31deg) rotate(31deg);
   -webkit-transform:skewX(-31deg) rotate(31deg);
   transform:skewX(-31deg) rotate(31deg);
}

.t .wrap .triangle:hover {
   background-color:blue;
   transform:translate(11%, 11%);
   -webkit-transform:translate(11%, 11%);
   -moz-transform:translate(11%, 11%);
}

.t .triangle:hover + .mask {
   -ms-transform:skewX(-31deg) rotate(31deg) translate(18.6%, 0);
   -webkit-transform:skewX(-31deg) rotate(31deg) translate(18.6%, 0);
   transform:skewX(-31deg) rotate(31deg) translate(18.6%, 0);
}

.t>div:nth-child(2) {
   -ms-transform:rotate(61deg) skewX(31deg);
   -webkit-transform:rotate(61deg) skewX(31deg);
   transform:rotate(61deg) skewX(31deg);
}

.t>div:nth-child(3) {
   -ms-transform:rotate(121deg) skewX(31deg);
   -webkit-transform:rotate(121deg) skewX(31deg);
   transform:rotate(121deg) skewX(31deg);
}

.t>div:nth-child(4) {
   -ms-transform:rotate(-61deg) skewX(31deg);
   -webkit-transform:rotate(-61deg) skewX(31deg);
   transform:rotate(-61deg) skewX(31deg);
}

.t>div:nth-child(5) {
   -ms-transform:rotate(-121deg) skewX(31deg);
   -webkit-transform:rotate(-121deg) skewX(31deg);
   transform:rotate(-121deg) skewX(31deg);
}

.t>div:nth-child(6) {
   -ms-transform:rotate(-181deg) skewX(31deg);
   -webkit-transform:rotate(-181deg) skewX(31deg);
   transform:rotate(-181deg) skewX(31deg);
}
</style> 
 </head> 
 <body> 
  <div class="t"> 
   <div class="wrap"> 
    <div class="triangle"></div> 
    <div class="mask"></div> 
   </div> 
   <div class="wrap"> 
    <div class="triangle"></div> 
    <div class="mask"></div> 
   </div> 
   <div class="wrap"> 
    <div class="triangle"></div> 
    <div class="mask"></div> 
   </div> 
   <div class="wrap"> 
    <div class="triangle"></div> 
    <div class="mask"></div> 
   </div> 
   <div class="wrap"> 
    <div class="triangle"></div> 
    <div class="mask"></div> 
   </div> 
   <div class="wrap"> 
    <div class="triangle"></div> 
    <div class="mask"></div> 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials