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

HTML Introduction to HTML and CSS (2016) Getting Familiar with HTML and CSS Building Web Pages with HTML and CSS

header .profile-image selector

Hi,

Why do we need to include the "header" part in the "header .profile-image" selector in the CSS when changing the hover state? Could we just use ".profile-image"?

Cheers.

1 Answer

Brandon White
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Brandon White
Full Stack JavaScript Techdegree Graduate 35,771 Points

Hi jasont2,

Yes. Technically, in this situation you could just use the class selector .profile-image by itself, but classes do not have to be unique on a page. So you could presumably reuse the "profile-image" class throughout a page (or series of pages), and so adding the specificity of header .profile-image assures you that only the profile-image in the header changes on hover.