Animated Underline

by pphheerroonn

HTML

<div class="undeline">
  <a>Hello</a>
  <a>There</a>
  <a>How</a>
  <a>Are</a>
  <a>You</a>
</div>

CSS

.underline > a {
  position: relative;
  color: red;
  text-decoration: none;
}

.underline > a:hover {
  color: red;
}
.underline > a:before {
  content: "";
  position: absolute;
  width: 100%;
  height: 2px;
  bottom: 0;
  left: 0;
  background-color: red;
  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;
}
.underline > a:hover:before {
  visibility: visible;
  -webkit-transform: scaleX(1);
  transform: scaleX(1);
}