<section class="home-mast">
<div class="home-mast__container">
<div>
<div class="absolute-bg" style="background-image: url('https://source.unsplash.com/3IEZsaXmzzs/1500x1200');"></div>
</div>
<div class="">
<div class="absolute-bg" style="background-image: url('https://source.unsplash.com/BIZv8MWH00s/1500x1200');"></div>
</div>
<div class="">
<div class="absolute-bg" style="background-image: url('https://source.unsplash.com/z55CR_d0ayg/1500x1200');"></div>
</div>
<div class="">
<div class="absolute-bg" style="background-image: url('https://source.unsplash.com/-FgZlbzZ0R8/1500x1200');"></div>
</div>
</div>
</section>
// Variables
$color-alpha: #00a19b;
$color-beta: #bb1654;
$color-gamma: #006ba6;
$color-delta: #e6661f;
$color-white: #fff;
// Mixins
@mixin hover-overlay($background) {
&:after {
content: "";
position: absolute;
top: 0;
left: 0;
z-index: 0;
height: 100%;
width: 100%;
background-color: $background;
opacity: 0;
transition: opacity 0.4s ease-in-out;
}
&:hover {
&:after {
opacity: 0.65;
transition-delay: 0.6s;
}
}
}
// Base
* {
box-sizing: border-box;
}
body {
margin: 0;
}
// Helpers
.absolute-bg {
position: absolute;
top: 0;
left: 0;
z-index: 0;
height: 100%;
width: 100%;
background-position: 50%;
background-repeat: no-repeat;
background-size: cover;
overflow: hidden;
}
// Home Mast
.home-mast {
height: 100vh;
&__container {
display: flex;
height: 100%;
& > * {
position: relative;
flex-grow: 1;
padding: 1em;
transition: flex-grow 0.6s cubic-bezier(0.4,0,0.2,1) 0.2s;
&:hover {
flex-grow: 3;
}
&:nth-child(1) {
@include hover-overlay($color-alpha);
}
&:nth-child(2) {
@include hover-overlay($color-beta);
}
&:nth-child(3) {
@include hover-overlay($color-gamma);
}
&:nth-child(4) {
@include hover-overlay($color-delta);
}
}
}
}
View Compiled
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.