Link underline animation
Link hover underline effect
by davidxmartins
HTML
<a href="#"><h1 class="hover-underline-animation">Link Underline Animation</h1></a>
CSS
.hover-underline-animation {
display: inline-block;
position: relative;
color: #000;
margin: 0 auto;
}
.hover-underline-animation::after {
content: '';
position: absolute;
width: 100%;
transform: scaleX(0);
height: 4px;
bottom: 0;
left: 0;
background-color: #000;
transform-origin: bottom right;
transition: transform 0.25s ease-out;
}
.hover-underline-animation:hover::after {
transform: scaleX(1);
transform-origin: bottom left;
}
/* Fiddle Styles */
body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
overflow: hidden;
font-family: sans-serif;
text-align: center;
}