<div class="container">
  <a class="link">A 标签 I'm a super cool link because my underline animation works even in multiple lines!</a>
  <p class="link">P 标签 I'm a super cool link because my underline animation works even in multiple lines!</p>
  <span class="link">SPAN 标签 I'm a super cool link because my underline animation works even in multiple lines!</span>
</div>
* {
  margin: 0;
  padding: 0;
}
.container {
  width: 400px;
/*   display: flex; */
}
p{
  display:inline-block;
}
.link {
  width: calc(100%);
  font-size: 1rem;
  font-weight: bold;
  text-decoration: none;
  font-family: sans-serif;
  color: #333;
  background-image: linear-gradient(transparent 90%, black 10px);
  background-repeat: no-repeat;
  background-size: 0% 100%;
  transition: background-size 1s;
}

.link:hover {
  background-size: 100% 100%;
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.