Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

Descendant (space) combinator

Specifies an arbitrary ancestral relationship between selector elements.

CSS 2.1, Section 5.5

 

Syntax

first second { ... }

Parameters

first

A CSS simple selector.

second

A CSS simple selector.

Standards information

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, Level 1 (CSS1).

To skip over a generation of elements and pass styles to descendants beyond child elements, combine the Universal (*) Selector with the Descendant Combinator. For example, the following selector matches any p elements that are not direct descendants (grandchildren or later) of a div element.

DIV * P {}

Examples

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>

 

 

Show:
© 2015 Microsoft