Font in CSS | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Font in CSS

p { font-weight: bold; font-size: 14pt; font-family: Georgia, serif; } • How can I rewrite this code in one line ?

1st Aug 2020, 10:29 AM
Noud Al Mansouri
Noud Al Mansouri - avatar
2 Answers
+ 14
https://www.w3schools.com/css/css_font_shorthand.asp so following by the examples on the link: p { font: bold 14pt Georgia, serif; }
1st Aug 2020, 10:31 AM
Burey
Burey - avatar
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; }
4th Aug 2020, 3:16 AM
Bits!