0
Font in CSS
p { font-weight: bold; font-size: 14pt; font-family: Georgia, serif; } • How can I rewrite this code in one line ?
2 Antworten
+ 14
https://www.w3schools.com/css/css_font_shorthand.asp
so following by the examples on the link:
p {
font: bold 14pt Georgia, serif;
}
0
• CSS shorten code method:
To shorten the code, it is also possible to specify all the individual font properties in one property.
The font property is a shorthand property for:
font-style
font-variant
font-weight
font-size/line-height
font-family
• Example:
Set some font properties with the shorthand declaration:
p.a {
font: 20px Arial, sans-serif;
}
p.b {
font: italic small-caps bold 12px/30px Georgia, serif;
}
• Your code will seem like that:
p {
font: bold 14pt Georgia, serif;
}