Is it possible to create a CSS selector for \'element with class b, which is a descendant of an element with class a\'?
Thanks, Rasto
Given the mark-up:
first B element
first C element
Second B element
Yeah, for all descendants:
.elementClassA .elementClassB {
}
The above will target both the first B element and the Second B element: JS Fiddle demo.
For immediate descendants:
.elementClassA > .elementClassB {
}
This will target only the first B element: JS Fiddle demo.
References: