Last active
August 29, 2015 14:27
-
-
Save tmslnz/1a84f6d387efacb25732 to your computer and use it in GitHub Desktop.
LESS mixin for nicer, more controllable text underlines
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
// Fancy Underline | |
// Creates a nice underline for links using CSS linear gradient | |
// with control on width, color and distance from baseline | |
// Inspired by Medium's technique ca. 2015 | |
.fancy-underline ( @color: rgba(0, 0, 0, 0.5), @start: 0.05em, @end: 0.15em ) { | |
text-decoration: underline; | |
// Use Modernizr | |
// http://modernizr.com/download/#-cssgradients-printshiv-cssclasses-prefixes-cssclassprefix:has! | |
.has-cssgradients & { | |
text-decoration: none; | |
background-image: linear-gradient(to top, transparent, transparent @start, @color @start, @color @end, transparent @end ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment