CSS -Schriftarteigenschaft
Die CSS-Font-Eigenschaft
Um den Code zu verkürzen, ist es auch möglich, alle einzelnen Font-Eigenschaften in einer Eigenschaft anzugeben.
Die font
Eigenschaft ist eine abgekürzte Eigenschaft für:
font-style
font-variant
font-weight
font-size/line-height
font-family
Hinweis: Die
Werte font-size
und sind erforderlich. font-family
Wenn einer der anderen Werte fehlt, wird deren Standardwert verwendet.
Beispiel
Verwenden Sie font
, um mehrere Schriftarteigenschaften in einer Deklaration festzulegen:
p.a
{
font: 20px Arial, sans-serif;
}
p.b
{
font: italic small-caps bold 12px/30px Georgia, serif;
}
Alle CSS-Schrifteigenschaften
Property | Description |
---|---|
font | Sets all the font properties in one declaration |
font-family | Specifies the font family for text |
font-size | Specifies the font size of text |
font-style | Specifies the font style for text |
font-variant | Specifies whether or not a text should be displayed in a small-caps font |
font-weight | Specifies the weight of a font |