A Pen by Richard Leishman on CodePen.
Last active
January 9, 2017 15:02
-
-
Save mrl22/a4df933c379a31abcfaf55c8eff7cf97 to your computer and use it in GitHub Desktop.
Slide out underline
This file contains hidden or 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
| <a class="underline">My Link</a> | |
| <a class="underline active">My Link</a> |
This file contains hidden or 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
| $underline-color: #000; | |
| $underline-distance: 5px; | |
| $underline-thickness: 2px; | |
| a.underline { | |
| position: relative; | |
| color: #000; | |
| text-decoration: none; | |
| padding-bottom: $underline-distance; | |
| &:hover, &.active { | |
| color: #000; | |
| &:before { | |
| width: 100%; | |
| } | |
| } | |
| &:before { | |
| content: ""; | |
| position: absolute; | |
| width: 0%; | |
| height: $underline-thickness; | |
| bottom: 0; | |
| left: 0; | |
| background-color: $underline-color; | |
| transition: width .3s; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment