Please note, this is a STATIC archive of website developer.mozilla.org from November 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Child selectors

Esta tradução está incompleta. Ajude atraduzir este artigo.

The > combinator separates two selectors and matches only those elements matched by the second selector that are direct children of elements matched by the first. By contrast, when two selectors are combined with the descendant selector, the combined selector expression matches those elements matched by the second selector for which there exists an ancestor element matched by the first selector, regardless of the number of "hops" up the DOM.

Sintaxe

selector1 > selector2 { style properties }

Exemplo

span { background-color: white; }
div > span {
  background-color: DodgerBlue;
}
<div>
  <span>Span 1. In the div.
    <span>Span 2. In the span that's in the div.</span>
  </span>
</div>
<span>Span 3. Not in a div at all.</span>

Especificações

Especificação Status Comentário
Selectors Level 4
The definition of 'child combinator' in that specification.
Working Draft  
Selectors Level 3
The definition of 'child combinators' in that specification.
Recommendation Sem mudanças
CSS Level 2 (Revision 1)
The definition of 'child selectors' in that specification.
Recommendation Definição inicial

Compatibilidade de Browsers

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

Etiquetas do documento e colaboradores

 Colaboradores desta página: izaiasneto4
 Última atualização por: izaiasneto4,