Skip to content

Instantly share code, notes, and snippets.

@reinislejnieks
Last active September 15, 2017 09:09
Show Gist options
  • Select an option

  • Save reinislejnieks/c56f47ac15fb4226fab5b291cae3ed88 to your computer and use it in GitHub Desktop.

Select an option

Save reinislejnieks/c56f47ac15fb4226fab5b291cae3ed88 to your computer and use it in GitHub Desktop.
#scss mixins for text underline
/* mixins for text underline */
@mixin text-underline-crop($background) {
text-shadow: .03em 0 $background,
-.03em 0 $background,
0 .03em $background,
0 -.03em $background,
.06em 0 $background,
-.06em 0 $background,
.09em 0 $background,
-.09em 0 $background,
.12em 0 $background,
-.12em 0 $background,
.15em 0 $background,
-.15em 0 $background;
}
@mixin text-underline($under-c) {
background-image: linear-gradient($under-c, $under-c);
background-size: 2px 2px;
background-repeat: repeat-x;
background-position: 0% 95%;
}
@mixin text-selection($selection) {
&::selection {
@include text-underline-crop($selection);
background: $selection;
}
&::-moz-selection {
@include text-underline-crop($selection);
background: $selection;
}
}
@mixin link-underline($background, $text, $underline-color, $selection){
@include text-underline-crop($background);
@include text-underline($underline-color);
@include text-selection($selection);
color: $text;
text-decoration: none;
*,
*:after,
&:after,
*:before,
&:before {
text-shadow: none;
}
&:visited {
color: $text;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment