MDN wants to talk to developers like you: https://qsurvey.mozilla.com/s3/8d22564490d8

:first-of-type

This translation is incomplete. Please help translate this article from English.

Sumari

La pseudo-classe CSS :first-of-type representa el primer germà del seu tipus en la llista dels fills del seu element pare.

Sintaxi

:first-of-type { style properties }

Exemple

Aquest exemple mostra com s'assumeix el selector universal quan no s'escriu cap selector simple.

div :first-of-type {
  background-color: lime;
}
<div>
  <span>This span is first!</span>
  <span>This span is not. :(</span>
  <span>what about this <em>nested element</em>?</span>
  <strike>This is another type</strike>
  <span>Sadly, this one is not...</span>
</div>

...donarà com a resultat:

Especificacions

Especificació Estat Comentari
Selectors Level 4
The definition of ':first-of-type' in that specification.
Working Draft Sense canvis
Selectors Level 3
The definition of ':first-of-type' in that specification.
Recommendation Definició inicial

Característica Chrome Firefox (Gecko) Internet Explorer Opera Safari
Suport bàsic 1.0 3.5 (1.9.1) 9.0 9.5 3.2
Característica Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Suport bàsic 2.1 1.0 (1.9.1) 9.0 10.0 3.2

Veure

Document Tags and Contributors

 Contributors to this page: Legioinvicta
 Last updated by: Legioinvicta,