Skip to content

Instantly share code, notes, and snippets.

@donmccurdy
Last active July 4, 2016 20:06
Show Gist options
  • Save donmccurdy/a4421e7d9980d024d910d12580ef2512 to your computer and use it in GitHub Desktop.
Save donmccurdy/a4421e7d9980d024d910d12580ef2512 to your computer and use it in GitHub Desktop.
Fancy Underline (LESS Mixin)
/**
* Based on work by Jonathan Neal.
* https://codepen.io/jonneal/pen/PzGYEE
*/
@textUnderlineFade: 20%;
@textUnderlineColor: currentColor;
@textUnderlineBackgroundColor: #FFF;
@textUnderlinePosition: -.14em;
@textUnderlineSize: .05em;
@textUnderlineGap: .05em;
@textUnderlineGapMinimum: 2px;
.underline (@bgColor: @textUnderlineBackgroundColor) {
box-shadow:
inset 0 calc(@textUnderlinePosition + @textUnderlineSize) 0 0 @bgColor,
inset 0 @textUnderlinePosition 0 0 fade(@bgColor, @textUnderlineFade),
inset 0 @textUnderlinePosition 0 0 @textUnderlineColor;
text-decoration: none;
text-shadow:
@textUnderlineGap 0 @bgColor,
-@textUnderlineGap 0 @bgColor,
@textUnderlineGapMinimum 0 @bgColor,
-@textUnderlineGapMinimum 0 @bgColor;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment