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

JavaScript Using jQuery Plugins Add a Sticky Navigation Bar Adding Sticky Navigation

Juan García
Juan García
10,723 Points

Selecting several CSS selectors without a comma

In the video Dave McFarland uses this bit of code

.is-sticky .header {
  background-color: black;
}

I assume that when we use two or more css selectors like that it means we are selecting elements that have BOTH classes, is that right?

Also, I can't find the teacher notes about transitions ; )

Thank you!

3 Answers

Mark Buckingham
Mark Buckingham
5,574 Points

Hi,

In your example the css selector is looking for an element with the 'header' class within an element with the 'is-sticky' class. Adding a comma between them creates an OR condition and will apply to any element with either of the class names.

Mark.

Juan García
Juan García
10,723 Points

That solves my doubt, thanks Mark!

Thanks Mark!