Last active
January 9, 2017 05:16
-
-
Save himynameisdave/194624fe27354377d9181f753bfd134f to your computer and use it in GitHub Desktop.
A mixin for a stylish underline text effect
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
.link-underline(@color: blue, @size: 2px, @duration: 0.25s, @centered: false) { | |
color: @color; | |
display: inline-block; | |
position: relative; | |
text-decoration: none; | |
&:before { | |
background-color: @color; | |
content: ''; | |
height: @size; | |
position: absolute; | |
bottom: 0 - (@size/2); | |
transition: width @duration ease-in-out; | |
width: 100%; | |
& when (@centered = true) { | |
left: 50%; | |
transform: translateX(-50%); | |
} | |
} | |
&:hover { | |
&:before { | |
width: 0; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment