property

font — CSS reference

Shorthand sets core font selection and line height, also resetting omitted and reset-only font subproperties. Size and family are required outside system-font keywords. Inherited longhands; there is no single independent initial value. Place custom feature overrides after the shorthand.

Formal Syntax & Structure

css syntaxcss
[ <font-style> || <font-variant-css2> || <font-weight> || <font-width-css3> ]? <font-size> [ / <line-height> ]? <font-family># | <system-font-family-name>

Working Example

Example Snippetcss
<!doctype html><html lang="en"><meta charset="utf-8"><title>CSS font lab</title><style>body {margin:0} .sample {background:#dcebe9;color:#182e32}#a{font-feature-settings:"liga" 0}#a{font:italic 700 20px/1.5 serif}</style><body><p id="a">Office 012345 — typography</p><p id="b" lang="fa" dir="rtl">سلام دنیا</p></body></html>
CSS Reference