.bnto-hov-underline { position: relative; display: inline-block; color: hsl(5 100% 60%); text-decoration: none; } .bnto-hov-underline::after { content: ""; position: absolute; left: 0; bottom: -2px; width: 100%; height: 2.5px; background: hsl(5 100% 60%); transform: scaleX(0); transform-origin: left; transition: transform .3s; } .bnto-hov-underline:hover::after { transform: scaleX(1); }
<a class="bnto-hov-underline" href="#">リンクテキスト</a>
使い方のコツ
下線が伸びる向きは transform-origin で決まります。left なら左から、right なら右から、center なら中央から。width ではなく scaleX をアニメさせるとカクつかず滑らかです。