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

property incorrect error

I am trying to pass the code challenge but it's saying error. What am i doing wrong?

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

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

.button:hover {
    background: #356690;
  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

Jason Anders
MOD
Jason Anders
Treehouse Moderator 145,858 Points

Hey Ammar,

You want to set the transition-property as well as the transition-duration, but you only need to do this on the main class and not the pseudo-class.

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

.button:hover {
    background: #356690;
}

You're doing this in the main class because the transition-duration is the same for both hover and exit, and therefore doesn't need to be declared (duplicate code) twice. While your code will work in the real world, the challenge wants to see that you know it can be done this way (which is better because it is DRY).

Hope that helped. Keep Coding! :)