Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

CSS Animating SVG with CSS Transitions and Transforms Transitions and Transforms

Chibueze Oti
PLUS
Chibueze Oti
Courses Plus Student 9,108 Points

In style .css create a new rule that target .star-bg.Add 1s transition for the fill property

.star-bg { transition: .1s; }

.star-bg:hover { fill: #feae6e; }

index.html
<!DOCTYPE html>
<html>
<head>
    <title>Animating SVG with CSS</title>
    <link rel="stylesheet" href="base.css">
    <link rel="stylesheet" href="style.css">
</head>
<body>
  <svg xmlns="http://www.w3.org/2000/svg" viewBox="60 60 240 240">
    <g>
        <circle class="star-bg" fill="#40adcf" stroke="#fff" stroke-width="6" cx="180" cy="180" r="108.3"/>
        <path class="star" fill="#fff" stroke="#fff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" d="M180 107.8l16.9 52.1h54.8l-44.3 32.2 16.9 52.1-44.3-32.2-44.3 32.2 16.9-52.1-44.3-32.2h54.8z"/>
    </g>
      </svg>
</body>
</html>
style.css
/* Complete the challenge by writing CSS below */

.star-bg
{
  transition: .1s;
}

.star-bg:hover
{
 fill: #feae6e;
}

2 Answers

Simon Duchaine
Simon Duchaine
14,441 Points

You didn't specify for which property you wanted to transition. So in your transition selector, just specify fill before the time property.

Derick Brown
Derick Brown
7,361 Points

Simon was correct.

I got a tad bit lost. I don't remember him saying anything about "fill" being apart of the Transition selector. He seemed to have only put a length of animation and ease....or the word "transform", the length of animation, and the ease. Until I saw your comment I didn't know "fill" can take place of "transform" in the Transition selector haha.

Thank you for pointing this out.

Michael Kalmykov
Michael Kalmykov
8,919 Points

Can someone please explain how fill can both be a value for the attribute transition and an attribute in of itself with the value #feae6e applied to it?