Created
December 21, 2017 20:10
-
-
Save mcgwier/d30930564af8bca44601b7509aa37025 to your computer and use it in GitHub Desktop.
Clean underline link:hover transition (smooth underline width from 50% to 100%)
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
/* You're welcome. */ | |
a { | |
text-decoration: none; | |
position: relative; | |
overflow: hidden; | |
} | |
a:hover { | |
text-decoration: none; | |
} | |
a:after { | |
background-color: #fff; | |
bottom: -9px; | |
content: ""; | |
height: 2px; | |
position: absolute; | |
width: 0; | |
left: 50%; | |
max-width: 100%; | |
-moz-transform: translateX(-50%); | |
-ms-transform: translateX(-50%); | |
-webkit-transform: translateX(-50%); | |
transform: translateX(-50%); | |
-webkit-transition: width .1s; | |
-o-transition: width .1s; | |
transition: width .1s; | |
} | |
a:hover:after { | |
-webkit-transition: width .1s; | |
-o-transition: width .1s; | |
transition: width .1s; | |
width: 100%; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment