font
The CSS property font
is a shorthand for font-style
, font-variant
, font-weight
, font-strech
,font-size
, line-height
, fant-family
Syntax
font:
font-style
font-variant
font-weight
font-size/line-height
font-family
See the Pen
font-shorthand by majadc (@majadc)
on CodePen.
Mandatory values:
Without these values entire line of code will be null.
- font-size
- font-family
font-size: medium|
xx-small|x-small|small|smaller|
large|x-large|xx-large|larger|
length|initial|inherit;
font-family: font family name | initial | inherit
Optional values:
Omitting these values doesn’t make mistake.
- font-style
- font-variant
- font-weight
If omitted one of values the code is valid. Omitted value doesn’t have value of its parent value.
font-style: normal | italic | oblique | initial | inherit
font-variant: normal | small-caps | initial | inherit
font-weight: normal | bold | bolder | lighter |
100, 200, .. 400 (normal), 500,..900 |
initial | inherit