Skip to content

Instantly share code, notes, and snippets.

@mrl22
Last active January 9, 2017 15:02
Show Gist options
  • Select an option

  • Save mrl22/a4df933c379a31abcfaf55c8eff7cf97 to your computer and use it in GitHub Desktop.

Select an option

Save mrl22/a4df933c379a31abcfaf55c8eff7cf97 to your computer and use it in GitHub Desktop.
Slide out underline
<a class="underline">My Link</a>
<a class="underline active">My Link</a>
$underline-color: #000;
$underline-distance: 5px;
$underline-thickness: 2px;
a.underline {
position: relative;
color: #000;
text-decoration: none;
padding-bottom: $underline-distance;
&:hover, &.active {
color: #000;
&:before {
width: 100%;
}
}
&:before {
content: "";
position: absolute;
width: 0%;
height: $underline-thickness;
bottom: 0;
left: 0;
background-color: $underline-color;
transition: width .3s;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment