Make your landing page feel alive
Click the headline to replay
The prompt
Written from your settings. Paste it into your AI tool.
Animate the main headline in the hero section of my landing page with an effect called Word rise. Split the headline into words. Wrap each word in a span with overflow hidden and put the word inside an inner span. Each inner span starts pushed down by about 125 percent of its own height and slides up into place. Use a duration of 800ms, the easing cubic-bezier(0.22, 1, 0.36, 1) and a 70ms delay between words, so the sentence rises from left to right. Leave a little padding on the wrapper so letters like g and y are not clipped. Play it once when the page loads. 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-rise 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 Word rise with your settings. It assumes the headline has the class hero-title.
<!-- HTML -->
<!-- Word rise animation from https://smthngfun.com/a/word-rise -->
<h1 class="hero-title">Make your landing page feel alive</h1>
/* CSS */
.hero-title .word {
display: inline-block;
overflow: hidden;
vertical-align: bottom;
padding-bottom: 0.14em;
margin-bottom: -0.14em;
}
.hero-title .word > span {
display: inline-block;
transform: translateY(125%);
animation: word-rise 800ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
animation-delay: calc(var(--i) * 70ms);
}
@keyframes word-rise { to { transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) {
.hero-title .word > span { animation: none; transform: none; }
}
// JavaScript
const title = document.querySelector('.hero-title');
const text = title.textContent.trim();
title.setAttribute('aria-label', text);
title.innerHTML = text.split(/\s+/).map(function (word, i) {
return '<span class="word" aria-hidden="true"><span style="--i:' + i + '">' + word + '</span></span>';
}).join(' ');