create a responsive diamond shaped div with icons and border - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Shape

Description

create a responsive diamond shaped div with icons and border

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">
.diamond {<!--from ww  w.j a  v  a 2  s  .  c om-->
   padding-bottom:51%;
   width:51%;
   border:2px solid Chartreuse;
   transform:rotate(46deg);
   position:relative;
   margin:26%;
}

.cell {
   position:absolute;
   border-radius:51%;
   width:51px;
   height:51px;
   background-color:yellow;
   line-height:51px;
   text-align:center;
}

.t-l {
   top:0px;
   left:0px;
   transform:translate(-51%, -51%) rotate(-46deg);
}

.t-r {
   top:0px;
   right:0px;
   transform:translate(51%, -51%) rotate(-46deg);
}

.b-l {
   bottom:0px;
   left:0px;
   transform:translate(-51%, 51%) rotate(-46deg);
}

.b-r {
   bottom:0px;
   right:0px;
   transform:translate(51%, 51%) rotate(-46deg);
}
</style> 
 </head> 
 <body> 
  <div class="diamond"> 
   <div class="cell t-l">
     Lor 
   </div> 
   <div class="cell t-r">
     Lor 
   </div> 
   <div class="cell b-l">
     Lor 
   </div> 
   <div class="cell b-r">
     Lor 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials