Is there a difference between .class element and element.class in a CSS selector?
I had always been shown element.class but j
element.class selects all s with that class. .class element selects all s that are descendants of elements that have that class.
For example, HTML:
For example, CSS:
div.wrapper {
background-color: white; /* the div with wrapper class will be white */
}
.wrapper div {
background-color: red; /* all 3 child divs of wrapper will be red */
}