Contextual Selectors

Previous Next

See Also

A contextual selector consists of several simple selectors separated by spaces (all selectors described up to now are simple selectors). Only those HTML elements that match the last simple selector are addressed.

For example, this style sheet rule specifies that all list elements (LI) that occur within an unordered list (UL), no matter how many levels deep, have a small font size:

UL LI{ font-size: small;}

The following example specifies that all INPUT elements (the actual buttons) that occur any level deep within an HTML element with ID "SearchButtonGroup", have a font size of 70% relative to the font size of the parent element.

#SearchButtonGroup input { font-size: 70%;}