Skip to content

Instantly share code, notes, and snippets.

@tmslnz
Last active August 29, 2015 14:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tmslnz/1a84f6d387efacb25732 to your computer and use it in GitHub Desktop.
Save tmslnz/1a84f6d387efacb25732 to your computer and use it in GitHub Desktop.
LESS mixin for nicer, more controllable text underlines
// 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