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

Jack Hou
Jack Hou
6,975 Points

Descendant question?

In the video Transition part 2, one chunk of the css code is

.wrap:hover .box{ background: #F08080; margin-left: 75%; }

which allows the .box div to move around when hovering inside the .wrap element. When I remove the .box from the code above, why does it no longer function the same way? Am i still not hovering in the .wrap div?

1 Answer

What you're doing on that line, by using the selector:

.wrap:hover .box

is defining how you want the .box div to appear when the user hovers over the .wrap div (after the transition). So you have to select the .box div. If you merely selected:

.wrap:hover {...}

you would be defining between the curly brackets what you want the .wrap div to look like when the user hovers over the .wrap div.