Specifies a relationship between an ancestor selector element and a descendent element (child, grandchild, great-grandchild, etc).
Syntax
EF {sRules }
Possible values
E | String that specifies the name of a document language element type or simple selector. |
F | String that specifies the name of a document language element type or simple selector. |
sRules | String that specifies one or more cascading style sheet property/value pairs. |
Remarks
A descendant combinator is white space that separates two simple selectors. A selector of the form "E F" matches element F when it is an arbitrary descendant of some ancestor element E.
![]() |
---|
Descendant combinators were called contextual selectors in Cascading Style Sheets (CSS), Level 1 (CSS1) |
The Universal selector can be combined with the descendant combinator to skip over a generation of elements and pass styles to descendants beyond those of the child elements. For example, the following selector matches any P elements that are grandchildren or later descendants of a DIV element. (Note that the whitespace is the combinator, and not part of the universal selector.)
![]() | |
---|---|
div * p {} |
Example
The following style rule applies only to LI elements within a div with a class of menu. Note that the selected elements do not have to be a direct descendant of the <div> tag:
![]() | |
---|---|
<style> div.menu li {font-size: x-small;} </style> |
Standards information
This selector is defined in Cascading Style Sheets (CSS), Level 2 (CSS2).