"If a worker wants to do his job well, he must first sharpen his tools." - Confucius, "The Analects of Confucius. Lu Linggong"
Front page > Programming > Animated text underline in CSS only

Animated text underline in CSS only

Published on 2024-07-30
Browse:328

Animated underline

.animated-underline {
    position: relative;
    text-decoration: none;
}

.animated-underline::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 100%;
    width: 100%;
    height: 0.125em;
    background-color: hsl(200deg, 100%, 50%);
    transition: transform 320ms ease;
    transform: translate(-50%, 0%) scaleX(0);
    transform-origin: right;
}

.animated-underline:hover::after {
    transform-origin: left;
    transform: translate(-50%, 0%) scaleX(1);
}
Release Statement This article is reproduced at: https://dev.to/nureon22/animated-text-underline-in-css-only-4joo?1 If there is any infringement, please contact [email protected] to delete it
Latest tutorial More>

Disclaimer: All resources provided are partly from the Internet. If there is any infringement of your copyright or other rights and interests, please explain the detailed reasons and provide proof of copyright or rights and interests and then send it to the email: [email protected] We will handle it for you as soon as possible.

Copyright© 2022 湘ICP备2022001581号-3