Home >Web Front-end >CSS Tutorial >Can CSS3 Keyframes Animate Elements on Page Load Without JavaScript?
Can CSS3 transitions seamlessly animate elements on page load without JavaScript's aid?
Exploring the Options:
The quest for a solution led to several avenues:
The Revelation: Keyframes to the Rescue
Contrary to earlier beliefs, CSS3 Keyframes can indeed animate on page load.
Example: Sliding Menu
Observe a sleek navigation menu that glides into view using only CSS3:
@keyframes slideInFromLeft { 0% { transform: translateX(-100%); } 100% { transform: translateX(0); } } header { animation: 1s ease-out 0s 1 slideInFromLeft; background: #333; padding: 30px; }
<header> <a href="#">Home</a> <a href="#">About</a> <a href="#">Products</a> <a href="#">Contact</a> </header>
The above is the detailed content of Can CSS3 Keyframes Animate Elements on Page Load Without JavaScript?. For more information, please follow other related articles on the PHP Chinese website!