amanda-olson
1/23/2019 - 4:53 PM

CSS Underline Animation

<a href="#">Link</a>
a {
  position: relative;
  color: #000;
  text-decoration: none;
}
 
a:hover {
  color: #000;
}
 
a:before {
  content: "";
  position: absolute;
  width: 100%;
  height: 2px;
  bottom: -5px;
  left: 0;
  background-color: #000;
  visibility: hidden;
  -webkit-transform: scaleX(0);
  transform: scaleX(0);
  -webkit-transition: all 0.3s ease-in-out 0s;
  transition: all 0.3s ease-in-out 0s;
}
 
a:hover:before {
  visibility: visible;
  -webkit-transform: scaleX(1);
  transform: scaleX(1);
}