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 trialPierre Ramirez
5,632 PointsI have "transition-property:background; transition-duration:.4s;" to both states. Not sure what I am doing wrong here.
I have the following for .button and .button:hover
transition-property:background; transition-duration:.4s;
thanks
/* Complete the challenge by writing CSS below */
.button {
background: #4682B4;
transition-property:background;
transition-duration:.4s;
}
.button:hover {
background: #356690;
transition-property:background;
transition-duration:.4s;
}
<!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>
2 Answers
Ali M Malik
33,293 PointsYou only need to assign the transition property on the original state. Not the hover state. your code should look like this
.button {
background: #4682B4;
transition-property:background;
transition-duration:.4s;
}
.button:hover {
background: #356690;
}
Hope this helps
Guil Hernandez
Treehouse TeacherYou only need to include the transition properties in the .button
rule. That will transition both the hover and off states.