CSS/Selectors/combinators/descendant

From W3C Wiki
< CSS‎ | Selectors
Revision as of 20:56, 26 September 2011 by Hiroki (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Descendant combinator A B

A selector of the form "A B" represents an element "B" that is an arbitrary descendant of some ancestor element "A".

Syntax

A B{ preperties }


Point, Note

  • A descendant combinator is whitespace that separates two sequences of simple selectors.


Example

[style.css]

 h1{
   font-size: 1.1em;
 }
 .myclass{
   font-style: italic;
 }
 h1 em{
   color: red;
 }


[index.html]

<body>
<h1>This <span class="myclass">headline
is <em>very</em> important</span>
</h1>
</body>

Css3 selectors descendant.png

CSS defines the Descendant combinator in 8.1. Descendant combinator.