View video tutorial
CSS Font Shorthand
CSS
The shorthand property sets all properties on a single line.
CSS font shorthand
The font property is a shorthand and sets all font properties on a single line.
The following font properties can be set using the shorthand font attribute.
font-style
font-variant
font-weight
font-size/line-height
(required)font-family
(required)
Optional properties are set to their default values.
Example
#p1 {
font: 20px Arial, sans-serif;
}
#p2 {
font: italic small-caps bold 12px/30px Georgia, serif;
}
#p3 {
font: italic small-caps bold 14px Georgia, serif;
}
Click on the "Try it Now" button to see how it works.