<ul class="menu">
    <li><a href="#">Home</a>
      <div class="linkBtmLine"></div>
    </li>
    <li><a href="#">About</a>
      <div class="linkBtmLine"></div>
    </li>
    <li><a href="#">Blog</a>
      <div class="linkBtmLine"></div>
    </li>
    <li><a href="#">Contact</a>
      <div class="linkBtmLine"></div>
    </li>
  </ul>
  <p>Hover on the links.</p>

  <ul class="menu2">
    <li><a href="#">Home</a>
      <div class="linkBtmLine2"></div>
    </li>
    <li><a href="#">About</a>
      <div class="linkBtmLine2"></div>
    </li>
    <li><a href="#">Blog</a>
      <div class="linkBtmLine2"></div>
    </li>
    <li><a href="#">Contact</a>
      <div class="linkBtmLine2"></div>
    </li>
  </ul>
  <p>Hover on the links.</p>
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

.menu {
  display: flex;
  list-style: none;
  background: #000;
}

a {
  color: white;
  text-decoration: none;
  font-size: medium;
}

.linkBtmLine {
  margin-top: 0.5rem;
  height: 4px;
  width: 100%;
  background-color: rgb(255, 255, 255);
  transform: scaleX(0);
  transition: transform 0.3s;
}

li:hover .linkBtmLine {
  transform: scaleX(1);
}

li {
  padding-top: 1rem;
  width: 70px;
  text-align: center;
}

p {
  margin: 1rem;
  font-size: x-large;
}

.menu2 {
  margin-top: 2rem;
  display: flex;
  list-style: none;
  background: #000;
}

a {
  color: white;
  text-decoration: none;
  font-size: medium;
}

.linkBtmLine2 {
  margin-top: 0.5rem;
  height: 4px;
  width: 100%;
  background-color: rgb(255, 255, 255);
  transform: translateX(-100%);
  transition: transform 0.3s;
}

li:hover .linkBtmLine2 {
  transform: translateX(0);
}

li {
  padding-top: 1rem;
  width: 70px;
  text-align: center;
  overflow: hidden;
}

p {
  margin: 1rem;
  font-size: x-large;
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.