CSS Animating SVG with CSS Transitions and Transforms Transitions and Transforms

Darius Chiseni
Darius Chiseni
6,981 Points

In style.css, create a new rule that targets .star-bg. Add a 1s transition for the fill property. howe do i do this

how do i target the fill in transition only

<!DOCTYPE html>
    <title>Animating SVG with CSS</title>
    <link rel="stylesheet" href="base.css">
    <link rel="stylesheet" href="style.css">
  <svg xmlns="http://www.w3.org/2000/svg" viewBox="60 60 240 240">
        <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"/>
/* Complete the challenge by writing CSS below */

1 Answer

Sean T. Unwin
Sean T. Unwin
Treehouse Moderator 28,623 Points

The format for transition is: transition: <propertyToApplyTransitionTo> <timing>. There are other options but these are the two we are concerned about at the moment. You can learn more from a previous lesson - https://teamtreehouse.com/library/fill-and-stroke-transitions, be sure to check the teacher's notes for reference links.

So you are requested to use fill as the property, which is placed before the 1s (timing). You still need both, you are only missing the first. Your answer going to be similar to: transition: <property> 1s;