I have the following HTML:
<div class="block-content no-title grey-bg">
How can I set the background of this div to the color to #333?
Is there some kind of CSS selector that I can use to select just those block-content divs that have grey-bg?
I have the following HTML:
<div class="block-content no-title grey-bg">
How can I set the background of this div to the color to #333?
Is there some kind of CSS selector that I can use to select just those block-content divs that have grey-bg?
There is something strange about your question.
This:
How can I set the background of this div to the color to #333?
Indicates you want this selector: [.grey-bg][.no-title][.block-content]
(use one or more of the parts in square brackets).
This:
Is there some kind of CSS selector that I can use to select just those block-content divs that have grey-bg?
indicates you want this: .grey-bg.block-content
.
in css the space (or lack thereof) between selectors indicates either descendant or same dom object i.e.
<span class="a b">
<span class="c"></span>
<span class="b"></span>
</span>
//some css selector examples
.a.b{} //gets the first span (get all elements which have class .a and .b)
.a .b{} //gets the third (nested in a.b after .c - get all .b that are descendants of .a)
.b{} //gets the first and third (get all .b)
.b>.b{} //gets the third (get all direct descendants of .b which are .b)
.b>.c+.b{} //gets the third (next sibling .b of a .c which is direct descendant of a .b)