A Pen by khuongyolo on CodePen.
Created
February 17, 2022 13:50
-
-
Save khuongyolo/3f9202d46558f84ec9fcb9e0ed51800c to your computer and use it in GitHub Desktop.
Underline-Animation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="container"> | |
<img src="https://images.unsplash.com/photo-1557912407-eb2900cf49e8?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=1050&q=80" /> | |
<div class="title">Butterfly</div> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@import url("https://fonts.googleapis.com/css2?family=Dancing+Script:wght@600&display=swap"); | |
* { | |
box-sizing: border-box; | |
margin: 0; | |
padding: 0; | |
} | |
.container { | |
display: flex; | |
flex-direction: column; | |
align-items: center; | |
} | |
.container:hover { | |
cursor: pointer; | |
} | |
.container img { | |
filter: grayscale(); | |
width: 200px; | |
height: 200px; | |
border-radius: 50%; | |
border: 6px solid whitesmoke; | |
box-shadow: 2px 2px 10px 2px rgba(0, 0, 0, 0.5); | |
margin-bottom: 1rem; | |
transition: filter 0.4s ease-in-out; | |
} | |
.container:hover img { | |
filter: none; | |
} | |
.title { | |
font-family: "Dancing Script", cursive; | |
font-size: 3rem; | |
color: whitesmoke; | |
position: relative; | |
} | |
.title::after { | |
position: absolute; | |
content: ""; | |
width: 0%; | |
height: 4px; | |
background-color: whitesmoke; | |
left: 50%; | |
bottom: -10px; | |
transition: all 0.4s ease-in-out; | |
} | |
.container:hover .title::after { | |
width: 100%; | |
left: 0; | |
} | |
body { | |
background: darkslateblue; | |
height: 100vh; | |
display: flex; | |
justify-content: center; | |
align-items: center; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment