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 CSS - Beyond the Basics Understanding CSS Transitions and Transforms Transitions Challenge

Logan Wu
Logan Wu
10,792 Points

"Make sure you're writing the transition properties in the correct rule."

I do not know what's wrong with my code here. It works in the preview but it always says "Bummer! Make sure you're writing the transition properties in the correct rule." Can someone point it out to me? Thanks.

style.css
/* Complete the challenge by writing CSS below */

.button {  
  background: #4682B4;
  transition-duration: .4s;
}

.button:hover {
    background: #356690;
  transition-property: background;
  transition-duration: .4s;
}
index.html
<!DOCTYPE html>
<html>
<head>
    <title>CSS Transitions</title>
    <link rel="stylesheet" href="page.css">
    <link rel="stylesheet" href="style.css">
</head>
<body>
    <a class="button" href="#">Learn More</a>
</body>
</html>

1 Answer

Hugo Paz
Hugo Paz
15,622 Points

Hi Logan,

You need to set the transition on the default state of the button

.button {  
  background: #4682B4;
  transition-property: background;
  transition-duration: .4s;

}

.button:hover {
    background: #356690;
}

The transition will then kick in when the state changes (hover)

Logan Wu
Logan Wu
10,792 Points

Got it! Thank you!