Flex Selection #2 Hover filter effect
HTML
<section class="container">
<div class="section first">
<div class="cont_title">
<h1>kenai<br>fjords</h1>
<h3>National Park</h3>
</div>
<div class="cont_desc">
<p>Rappel into a crevasse, kayak through icebergs, and watch a glacier recede.</p>
</div>
</div>
<div class="section">
<div class="cont_title">
<h1>Hawai'i<br>Volcanoes</h1>
<h3>National Park</h3>
</div>
<div class="cont_desc">
<p>Rappel into a crevasse, kayak through icebergs, and watch a glacier recede.</p>
</div>
</div>
<div class="section">
<div class="cont_title">
<h1>Carlsbad<br>Caverns</h1>
<h3>National Park</h3>
</div>
<div class="cont_desc">
<p>Rappel into a crevasse, kayak through icebergs, and watch a glacier recede.</p>
</div>
</div>
<div class="section">
<div class="cont_title">
<h1>Bryce<br>Canyon</h1>
<h3>National Park</h3>
</div>
<div class="cont_desc">
<p>Rappel into a crevasse, kayak through icebergs, and watch a glacier recede.</p>
</div>
</div>
<div class="section">
<div class="cont_title">
<h1>Dry<br>Tortugas</h1>
<h3>National Park</h3>
</div>
<div class="cont_desc">
<p>Rappel into a crevasse, kayak through icebergs, and watch a glacier recede.</p>
</div>
</div>
</section>
SCSS
html, body{
margin: 0;
max-width: 100%;
height: 100%;
}
.container{
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
width: 100vw;
&:hover{
& > .section{
filter: brightness(22%);
}
& > .section:hover{
filter: brightness(100%);
}
}
.section{
flex-grow: 1;
position: relative;
height: 100%;
transition: all 0.4s;
align-items: center;
justify-content: center;
box-sizing: border-box;
text-align: center;
flex: 1;
.cont_title{
position:relative;
margin: auto;
width: 100%;
height: 300px;
text-align: center;
margin-top: 35vh;
h1{
text-transform: uppercase;
color: white;
font-family: 'Economica', sans-serif;
text-shadow: 1px 2px 5px rgba(0,0,0,0.5);
font-size: 3.5vw;
margin: 0;
transition: font-size 0.3s;
vertical-align: middle;
}
h3{
text-transform: uppercase;
font-family: 'Economica', sans-serif;
font-size: 1.3vw;
transition: all 0.3s;
color: white;
}
}
.cont_desc{
position: relative;
display: block;
text-align: center;
width: 60%;
height: auto;
margin: auto;
opacity: 0;
transition: opacity 0.4s;
padding-top: 20px;
p{
margin: 0;
font-family: 'Economica', sans-serif;
color: white;
font-size: 25px;
}
}
&:hover{
flex-grow: 1.8;
transition: flex 0.4s;
& > .cont_title h1{
font-size: 5.3vw;
transition: font-size 0.4s;
}
& > .cont_title h3{
font-size: 1.6vw;
transition: all 0.4s;
}
& > .cont_desc{
opacity: 1;
transition-delay: 1s;
transition: opacity 0.8s;
}
}
&:nth-child(1){
background: url("https://artsandculture.withgoogle.com/gcs/national-parks-service/en-us/Asset-Kenai-desktop.jpg") center;
}
&:nth-child(2){
background: url("https://artsandculture.withgoogle.com/gcs/national-parks-service/en-us/Asset-Hawaii-desktop.jpg") center;
}
&:nth-child(3){
background: url("https://artsandculture.withgoogle.com/gcs/national-parks-service/en-us/de0b954d-ca76-41d3-ac3a-900c6bc25139.jpg") center;
}
&:nth-child(4){
background: url("https://artsandculture.withgoogle.com/gcs/national-parks-service/en-us/Asset-Bryce-desktop.jpg") center;
}
&:nth-child(5){
background: url("https://artsandculture.withgoogle.com/gcs/national-parks-service/en-us/Asset-Tortugas-desktop.jpg") center;
}
}
}
1 Response