Selektory typu
Selektory typu dopasowują wszystkie elementy mające taką samą nazwę jak dany selektor. Własności zostaną zastosowane do każdego elementu danego typu niezależnie od tego, gdzie znajduje się w drzewie dokumentu.
Składnia
selektor {własności }
selektor
jest do dowolnym elementem np. p
, div
, a
, table
.
Przykład
CSS
span {
background-color: skyblue;
}
HTML
<span>Span z tekstem.</span>
<p>Akapit z tekstem.</p>
<span>Span z większą ilością tekstu.</span>
Rezultat
Specyfikacje
Specyfikacja | Status | Komentarz |
---|---|---|
Selectors Level 4 The definition of 'Type (tag name) selector' in that specification. |
Working Draft | No changes |
Selectors Level 3 The definition of 'type selectors' in that specification. |
Recommendation | No changes |
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 | Initial definition |
Kompatybilność przeglądarek
BCD tables only load in the browser