<p class="hover-p">Hover this text to see the effect!</p>
.hover-p {
display: inline-block;
position: relative;
color: #0087ca;
}
.hover-p::after {
content: '';
position: absolute;
width: 100%;
transform: scaleX(0); //一开始隐藏
height: 2px;
bottom: 0;
left: 0;
background-color: #0087ca;
transform-origin: bottom right; //右边消失
transition: transform 0.25s ease-out;
}
.hover-p:hover::after {
transform: scaleX(1);
transform-origin: bottom left; //移入的时候从左边入
}