El selector type CSS coincideix amb elements per nom del node. En altres paraules, selecciona tots els elements del tipus donat dins d'un document.
/* Tots els elements <a>. */
a {
color: purple;
}
Sintaxi
element { style properties }
Exemple
CSS
span {
background-color: skyblue;
}
HTML
<span>Here's a span with some text.</span>
<p>Here's a p with some text.</p>
<span>Here's a span with more text.</span>
Resultat
Especificacions
Especificació | Estat | Comentari |
---|---|---|
Selectors Level 4 The definition of 'Type (tag name) selector' in that specification. |
Working Draft | Sense canvis |
Selectors Level 3 The definition of 'type selectors' in that specification. |
Recommendation | Sense canvis |
CSS Level 2 (Revision 1) The definition of 'type selectors' in that specification. |
Recommendation | |
CSS Level 1 The definition of 'type selectors' in that specification. |
Recommendation | Definició inicial |
Navegadors compatibles
We're converting our compatibility data into a machine-readable JSON format.
This compatibility table still uses the old format,
because we haven't yet converted the data it contains.
Find out how you can help!
Descripció | Chrome | Edge | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|---|
Suport bàsic | (Yes) | (Yes) | (Yes) | (Yes) | (Yes) | (Yes) |
Descripció | Android | Chrome for Android | Edge | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|---|
Suport bàsic | ? | ? | (Yes) | ? | ? | ? | ? |