Skip to content

Instantly share code, notes, and snippets.

@wpflames
Created August 28, 2020 16:21
Show Gist options
  • Save wpflames/d750176ec70cb44f4a47b7b7d5124057 to your computer and use it in GitHub Desktop.
Save wpflames/d750176ec70cb44f4a47b7b7d5124057 to your computer and use it in GitHub Desktop.
Cards Hover Animation with CSS Flexbox - SCSS
*{
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Poppins', sans-serif;
}
body{
display: flex;
justify-content: center;
align-items: center;
background: #485563;
.container{
position: relative;
width: 1100px;
display: flex;
justify-content: center;
align-items: center;
flex-wrap: wrap;
padding: 30px;
min-height: 100vh;
.card{
position: relative;
max-width: 300px;
height: 215px;
background: white;
margin: 30px 10px;
padding: 20px 15px;
display: flex;
flex-direction: column;
box-shadow: 0 5px 202px rgba(0,0,0,.5);
transition: .3s ease-in-out;
margin-bottom: 80px;
&:hover{
height: 410px;
}
&:hover .content{
visibility: visible;
opacity: 1;
margin-top: 200px;
transition-delay: .2s;
}
.imgBx{
position: absolute;
width: 260px;
height: 260px;
top: -60px;
left: 20px;
box-shadow: 0 15px 20px -12px rgba(0,0,0,.8);
z-index: 1;
img{
max-width: 100%;
border-radius: 4px;
}
}
.content{
position: relative;
margin-top: -140px;
padding: 10px 15px;
text-align-last: center;
color: #111;
visibility: hidden;
opacity: 0;
transition: 0.3s ease-in-out;
a{
text-decoration: none;
background: #485563;
color: white;
padding: 10px 20px;
border-radius: 4px;
margin-top: 20px;
display: inline-block;
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment