CSS Creative DIV Shape with Cool Hover Effects 3 - Slanted / Skewed / Razor-Blade Div Shape Design

CSS Creative DIV Shape with Cool Hover Effects 3 - Slanted / Skewed / Razor-Blade Div Shape Design

by Ying Chor Ding

HTML

<div class="main">
<div class="layer1"></div>
<div class="layer2"></div>
<div class="content">
<h1>hello</h1>
</div>
</div>

CSS

* {
  margin: 0;
  padding: 0;
}
.main {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 800px;
  height: 400px;
}
.main .layer1 {
  width: 100%;
  height: 100%;
  background: #4ef75c;
  transform: skewX(-30deg);
  box-shadow: 0 0 0 15px #fff;
  transition: 0.5s;
  z-index: 1;
}
.main .layer2 {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #262626;
  z-index: -1;
  transition: 0.1s;
}
.main:hover .layer2 {
  transform: scaleX(1.5) scaleY(.8);
}
.content {
  position: absolute;
  top: 20px;
  left: 20px;
  bottom: 20px;
  background: #fff;
  padding: 50px;
  box-sizing: border-box;
  text-align: center;
  box-shadow: 0 10px 15px rgba(0, 0, 0,.4);
}