Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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.