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

General Discussion

Larry Cousino
Larry Cousino
23,127 Points

@Keyframes rules

I am working on an animation project in my CSS file and got working the way I needed it too, so I began to clean it up from being so DRY.

I have three keyframes names red, yellow and green and other than the background color, they share the same width and height. So I attempted to combine the three names with and with out commas and then listed the attribute values.

'''css @keyframes red, yellow, green { 0% { width: 165px; height: 0; } 100% { width: 165px; height: 165px; } } ''' and '''css @keyframes red yellow green { 0% { width: 165px; height: 0; } 100% { width: 165px; height: 165px; } } '''

When I do either one, my animation ceases to function.

Here's my inquiry. Can you have a keyframe with multiple names? If so, how?

Thanks! Larry

1 Answer

Sarah Bradberry
Sarah Bradberry
7,115 Points

None of the sites I've looked into mention having multiple identifiers with a single list of keyframes so I'm thinking the answer is no?