Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS Unused CSS Stages CSS Animations Full-Page Animation Project: Part 2

How do I activate an animation automatically when I refresh the page?

Guil shows you how to do it with a hover element but not without one.

1 Answer

Zhihao Wang
Zhihao Wang
9,687 Points

Instead of setting your animation to hover, just set it to a default styling. Here's what I mean.

.animationbackground{
     animation: /** Your Animation Here **/
}

This would tell the browser to start the animation imediately, instead of waiting for something like a hover effect like this:

.animationbackground:hover{
    animation: /** your Animation here **/
}

Happy Coding!

THANKS BUDDY :)

Zhihao Wang
Zhihao Wang
9,687 Points

Hey no problem!

I'm glad I could help.

Cheers!