Skip to content

Instantly share code, notes, and snippets.

@ffub
Created June 15, 2015 20:11
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 ffub/1062d270e50279ebbe60 to your computer and use it in GitHub Desktop.
Save ffub/1062d270e50279ebbe60 to your computer and use it in GitHub Desktop.
Consistent underlines using gradients
/*
* Consistent underlines using gradients
* https://medium.com/designing-medium/crafting-link-underlines-on-medium-7c03a9274f9
*/
@mixin underline($colour:currentColor, $line-offset:1, $line-size:0.1) {
text-decoration: none;
background-repeat: repeat-x;
background-size: #{$line-size}em #{$line-size}em;
background-position: 0 #{$line-offset}em;
background-image: -webkit-linear-gradient(top, transparent 50%, $colour 50%);
background-image: linear-gradient(top, transparent 50%, $colour 50%);
// IE < 10 doesn't get it
.lt-ie10 & {
background: none;
text-decoration: underline;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment