Join Eric Greene for an in-depth discussion in this video Combinators, part of More CSS Selectors for React Developers.
(soft music)…- [Instructor] Commonly, we want to select things…based upon the relationship between two selectors.…For example, we might want to select all of the list items…that are underneath an unordered list…or selecting all the list items…underneath of an ordered list…or maybe we have one section of the webpage…where we want to select all of the anchor tags…for that particular section.…
When we need to have multiple selectors defined…and then apply them to select items from the DOM,…this is called a combinator.…Now there's two types of relationships that we can have…to form combinators,…parent-child, also ancestor-descendant,…and then we can have sibling relationships,…the immediate sibling or one of the earlier siblings.…So these relationships allow us to select an element…within the context of another element.…
A common example of this for example…is when you're building menuing systems.…If you use the nav element,…which is one of the HTML5 semantic tags,…it's common that inside of that nav…you'll have unordered lists of anchor tags…
Share this video
Embed this video
Video: Combinators