<div class="container">
<div id="marketing" class="section">
<div class="content">
<h1>Marketing</h1>
</div>
<div class="overlay"></div>
</div>
<div id="technology" class="section">
<div class="content">
<h1>Technology</h1>
</div>
<div class="overlay"></div>
</div>
<div id="advertising" class="section">
<div class="content">
<h1>Advertising</h1>
</div>
<div class="overlay"></div>
</div>
</div>
* {
box-sizing: border-box;
}
body {
margin: 0;
padding: 0;
font-family: 'Montserrat', sans-serif;
}
.container {
display: flex;
height: 100vh;
}
.section {
flex: 1;
display: flex;
justify-content: center;
align-items: center;
height: 100%;
overflow: hidden;
background-size: cover;
background-position: center;
color: #fff;
transition: flex .4s ease;
position: relative;
}
.section .overlay {
background-color: rgba(0, 0, 0, 0.7);
width: 100%;
height: 100%;
position: absolute;
transition: background-color .8s ease;
}
.section .content {
z-index: 2;
}
.section:hover {
flex: 2;
}
.section:hover .overlay {
background-color: rgba(0, 0, 0, 0.95);
}
#marketing {
background-image: url(https://images.unsplash.com/photo-1522205987242-8e22924ab42a?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=c0f679eb8f15705d46ea90008f39642b&auto=format&fit=crop&w=500&q=60);
}
#technology {
background-image: url(https://images.unsplash.com/photo-1530893609608-32a9af3aa95c?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=fe6b92f88f55824e64a1bae15f5bf52a&auto=format&fit=crop&w=500&q=60);
}
#advertising {
background-image: url(https://images.unsplash.com/photo-1517799094725-e3453440724e?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=353f3663a9fae75773d2942aeb37c2c8&auto=format&fit=crop&w=500&q=60);
}
/*
Nothing to see here :)
---
Explanation of the code: https://youtu.be/Iz-uUuTpohk
---
*/
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.