Descendant

Specifies a relationship between an ancestor selector element and a descendent element (child, grandchild, great-grandchild, etc).

Syntax

E F {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.

Note

Descendant combinators were called contextual selectors in Cascading Style Sheets (CSS), Level 1 (CSS1) Ee371306.xtlink_newWindow(en-us,Expression.40).png.

The Universal selector 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) Ee371306.xtlink_newWindow(en-us,Expression.40).png.

See also

Concepts

Understanding selectors
Adjacent sibling
Child
General sibling

Send feedback about this topic to Microsoft. © 2011 Microsoft Corporation. All rights reserved.