Reputation: 4054
Lets say I have a div with class DIVCLASS, and I have elements with class ELEMENTCLASS. How can I select all elements with class: ELEMENTCLASS that are in divs with class: DIVCLASS?
Upvotes: 0
Views: 147
Reputation: 2677
Depends,
Does it matter at which level ELEMENTCLASS is situated in DIVCLASS?
If not, use:
.divclass .elementclass {
//properties here
}
If you only want to select ELEMENTCLASS that are direct descendants of DIVCLASS, use:
.divclass > .elementclass {
//properties here
}
Don't overspecify by using div.divclass unless it's really necessary.
Upvotes: 2