Last active
December 10, 2017 16:04
-
-
Save AndyCouch/8e64084999cc5cb36fb803cf900ac57f to your computer and use it in GitHub Desktop.
Cross-browser underline with breaks for descenders.
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
@mixin link( | |
$text-color : black, | |
$text-color-hover: green, | |
$line-color : blue, | |
$line-color-hover: red, | |
$background-color: white | |
) { | |
color: $text-color; | |
span { | |
color: currentColor; | |
text-decoration: underline; | |
} | |
&:hover { | |
color: $text-color-hover; | |
} | |
@supports (text-decoration-skip: ink) { | |
span { | |
text-decoration-skip: ink; | |
text-decoration-skip-ink: auto; | |
text-decoration-color: $line-color; | |
} | |
&:hover { | |
span { | |
text-decoration-color: $line-color-hover; | |
} | |
} | |
} | |
@supports not (text-decoration-skip: ink) { | |
span { | |
text-decoration: none; | |
position: relative; | |
text-shadow: 3px 0 0 $background-color, -3px 0 0 $background-color, 0 2px $background-color; | |
z-index: 0; | |
&::after { | |
content: ""; | |
position: absolute; | |
left: 0; | |
bottom: 1px; | |
width: 100%; | |
height: 1px; | |
z-index: -1; | |
background-color: $line-color; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment