JSFiddle - React, Tailwind, and code Playground
CSS Call to Action Box
by Jennifer Perrin
HTML
<div class="callBox">
<div class="box callBox-outer">
<div class="box callBox-inner">hover</div>
<div class="box-rotate">
<div class="quart callBox-red"></div>
<div class="quart callBox-green"></div>
<div class="quart callBox-blue"></div>
<div class="quart callBox-yellow"></div>
</div>
</div>
</div>
CSS
html, body {
background-color: #212121;
}
html *, body * {
box-sizing: border-box;
}
.callBox {
position: relative;
background: #212121;
width: 300px;
height: 300px;
padding: 50px 0;
}
.callBox .box { overflow: hidden; }
.callBox-outer {
padding: 5px;
position: relative;
width: 200px;
height: 200px;
margin: 0 auto;
}
.callBox-inner {
width: 195px;
height: 195px;
background: #212121;
top: 50%;
left: 50%;
-webkit-transform: translateX(-50%) translateY(-50%) scale(0.95);
-ms-transform: translateX(-50%) translateY(-50%) scale(0.95);
transform: translateX(-50%) translateY(-50%) scale(0.95);
position: absolute;
z-index: 1;
text-align: center;
line-height: 195px;
-webkit-transition: all 0.6s cubic-bezier(0.19, 1, 0.22, 1);
transition: all 0.6s cubic-bezier(0.19, 1, 0.22, 1);
color: #25C1BB;
-webkit-backface-visibility: hidden;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.box-rotate {
position: absolute;
width: 400px;
height: 400px;
top: -100px;
left: -100px;
-webkit-transition: all 0.8s cubic-bezier(0.19, 1, 0.22, 1);
transition: all 0.8s cubic-bezier(0.19, 1, 0.22, 1);
}
.box-rotate .quart {
width: 200px;
height: 200px;
position: absolute;
}
.box-rotate .callBox-red {
top: 0;
left: 0;
background: #ff1200;
}
.box-rotate .callBox-green {
top: 0;
left: 200px;
background: #00c01b;
}
.box-rotate .callBox-blue {
top: 200px;
left: 200px;
background: #3c3cff;
}
.box-rotate .callBox-yellow {
top: 200px;
left: 0;
background: #f5ec00;
}
.callBox-outer:hover {
cursor: pointer;
}
.callBox-outer:hover .callBox-inner {
width: 195px;
height: 195px;
-webkit-transform: translateX(-50%) translateY(-50%) scale(1);
-ms-transform: translateX(-50%) translateY(-50%) scale(1);
transform: translateX(-50%) translateY(-50%) scale(1);
background: #313131;
}
.callBox-outer:hover .box-rotate {
...