Make your landing page feel alive
Click any word to animate that one
The prompt
Written from your settings. Paste it into your AI tool.
Animate one word in the main headline of my landing page with an effect called Underline draw. In my example the headline reads "Make your landing page feel alive" and the animated word is "alive". Apply it to the word I point out in my own headline, and ask me which one if I have not said. Keep the headline still and draw an underline beneath that word. The line is 0.09em thick with fully rounded ends, in my accent colour. The line sits just under the baseline without touching the next line of text. Layer it behind the letters, so the text always stays on top. It grows from left to right by scaling on the X axis over 700ms with the easing cubic-bezier(0.65, 0, 0.35, 1), starting 500ms after the page loads. Build it as a pseudo element on a span around the word so it adds no height to the line. Play it once and leave the line in place. Keep my existing font, colours and layout exactly as they are. Screen readers and search engines must still read the headline as one normal sentence, so put the full text in an aria-label on the heading and mark any decorative spans as aria-hidden. If the visitor has prefers-reduced-motion turned on, show the finished headline straight away with no animation. Make sure nothing shifts the layout while it plays. Use plain CSS and a little vanilla JavaScript, unless my project already has an animation library, in which case use that. A live demo with reference code for these exact settings is at https://smthngfun.com/a/word-underline and you can use that code as your starting point, adapted to my codebase and styling. If I am happy to credit the source, add a small "Animation by smthngfun" link to https://smthngfun.com in the footer of the page. Ask me before adding it.
Reference code
A working version of Underline draw with your settings. It assumes the headline has the class hero-title.
<!-- HTML -->
<!-- Underline draw animation from https://smthngfun.com/a/word-underline -->
<h1 class="hero-title">Make your landing page feel <span class="underline">alive</span></h1>
/* CSS */
.hero-title .underline {
position: relative;
z-index: 0; /* keeps the line and the letters layered together */
display: inline-block;
white-space: nowrap;
}
.hero-title .underline::after {
content: "";
position: absolute;
left: 0;
right: 0;
bottom: -0.03em;
z-index: -1; /* behind the letters */
height: 0.09em;
border-radius: 0.09em;
background: var(--accent, currentColor);
transform: scaleX(0);
transform-origin: 0 50%;
animation: underline-draw 700ms cubic-bezier(0.65, 0, 0.35, 1) 500ms forwards;
}
@keyframes underline-draw { to { transform: scaleX(1); } }
@media (prefers-reduced-motion: reduce) {
.hero-title .underline::after { animation: none; transform: none; }
}