Don’t understand the difference between chaining selectors and nesting elements

I need help please. I don’t understand the difference between chaining selectors and nesting elements - in order words, how does h2.destination differ from description.h5 (aside from text size, of course)?

header elements have other roles then just being bigger in font-size

h2.destination will target all elements heading level 2 element with class destination, description.h5 would target all description elements (which do not exist) with class h5, which is not what i would use as class name, given its already the name of an element

2 Likes

description.h5 is in one of the steps in the lesson. Could you please provide an example of when would use h1.destination and when you would use description.h1? I’m still confused about the difference.

i might certainly hope not, can you provide the url to this lesson?

i can’t, given description.h1 is not possible, description is not an existing element

Sorry, I made a mistake: it’s .description h5.

We learned h2.destination and then .description h5. I just don’t understand the difference. When do you use one, and when do you use the other?

that is quite a difference

h2.destination will target all h2 elements with class destination

.description h5 will target all h5 elements nested within elements who have class description

5 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.