<div id="wrap">
<!-- section -->
<div class="section">
<div class="center">
<div class="block block--1"></div>
<div class="block block--2"></div>
</div>
</div>
<!--/section -->
</div>
html,
body {
margin: 0;
padding: 0;
font-family: sans-serif;
font-size: 16px;
line-height: 1.4;
color: #555;
background: #fff;
}
* {
box-sizing: border-box;
}
#wrap {
position: relative;
}
.section {
padding: 40px;
}
.center {
width: 100%;
max-width: 980px;
margin: auto;
}
.block {
display: inline-block;
width: 100px;
height: 100px;
margin: 10px;
&::before {
content: '';
display: block;
width: 100%;
height: 100%;
background: #000;
transition: all 2s cubic-bezier(0.5, -0.5, 0.5, 1.5);
}
&--1 {
&:hover {
&::before {
opacity: .2;
}
}
}
&--2 {
&:hover {
&::before {
transform: scale(.2);
}
}
}
}
View Compiled
This Pen doesn't use any external CSS resources.