Proprietà del carattere CSS
La proprietà del carattere CSS
Per abbreviare il codice, è anche possibile specificare tutte le singole proprietà dei caratteri in un'unica proprietà.
La font
proprietà è una proprietà abbreviata per:
font-style
font-variant
font-weight
font-size/line-height
font-family
Nota: i
valori font-size
e sono obbligatori. font-family
Se uno degli altri valori manca, viene utilizzato il loro valore predefinito.
Esempio
Utilizzare font
per impostare diverse proprietà dei caratteri in una dichiarazione:
p.a
{
font: 20px Arial, sans-serif;
}
p.b
{
font: italic small-caps bold 12px/30px Georgia, serif;
}
Tutte le proprietà dei caratteri CSS
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 |