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 Animating SVG with CSS Transitions and Transforms Transitions and Transforms

Marie Jeffries
Marie Jeffries
2,972 Points

I am stuck on this. Can someone explain to me why this isn't changing the fill color on hover?

Do I need use fill-color:?

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: fill 1s;
}
.star-bg hover {
  fill: steelblue;
}

2 Answers

Ryan Dower
Ryan Dower
2,454 Points

Hi - apologies, this may not help in the slightest as I'm a rookie and this is pretty advanced for me, but I did happen to learn about descendant selectors and pseudo classes here: https://teamtreehouse.com/library/css-basics-5/descendant-selectors

I noticed you are using a descendent selector in your css. I see in the HTML the class for .star-bg but I don't see any class, type or id selectors etc for "hover". so maybe your trying to use a pseudo class. In which case try .star-bg:hover {

I hope that helps. 😊

Marie Jeffries
Marie Jeffries
2,972 Points

You were absolutely right. I completely forgot the colon. Thank you so much!!