Descendant selectors

Summary

The combinator (that's meant to represent a space, or more properly one or more whitespace characters) combines two selectors such that the combined selector matches only those elements matching the second selector for which there is an ancestor element matching the first selector. Descendant selectors are similar to child selectors, but they do not require that the relationship between matched elements be strictly parent-child.

Syntax

selector1 selector2 { style properties }

Example

span { background-color: white; }
div span { background-color: DodgerBlue; }
<div>
  <span>Span 1.
    <span>Span 2.</span>
  </span>
</div>
<span>Span 3.</span>

Specifications

Specification Status Comment
CSS Selectors Level 3 Recommendation  
CSS 2.1 Recommendation  
CSS 1 Recommendation  

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support (Yes) (Yes) (Yes) (Yes) (Yes)
Feature Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support ? ? ? ? ?

See also

Document Tags and Contributors

Contributors to this page: Sheppy, SphinxKnight, Miken32, FredB, Pointy, teoli, Wjjohnst
Last updated by: SphinxKnight,
Hide Sidebar