Reputation: 13
I want to have a DIV whose background color is light grey, but I want the background color for HRs to be black. I'd like to have one class for the DIV that can control both of these so I don't have to apply a separate class for each HR?
Upvotes: 0
Views: 37
Reputation: 333
A class can't control both of them, but it's possible to not have to apply a separate class for each HR.
Upvotes: 0
Reputation: 19764
What you describe is not possible. However, you might be looking for this:
div hr {
background-color: black;
}
div hr
will match all hr
which are descendants of div
. This means you do not have to apply a class for each hr
element, which is what you requested in the question.
For direct descendants only (children), use div > hr
.
Upvotes: 1