/    Sign up×
Reference /Pin to ProfileBookmark

The font property is shorthand for font-style, font-variant, font-weight, font-size/line-height, and font-family (in that order).

Syntax

Default values are used if any of the optional values are missing, but font-size and font-family are required.

/*
    wrap <code> tags inside <pre> tags to create code blocks like this
*/

Values

font-style
Designates a text’s font style. Default: “normal”.

font-variant
Designates whether or not text should be displayed in a small-caps font. Default: “normal”.

font-weight
Determines how thin or thick text characters will be displayed. Default: “normal”.

font-size/line-height
Designates a text’s font size and line-height. Default: “normal”.

font-family
Designates a text’s font family. Default: browser’s determination.

caption
Uses the same font as what is used by captioned controls (drop-downs, buttons, etc.)

icon
Uses the same font as what is used by icon labels.

menu
Uses the same font as what is used by dropdown menus.

message-box
Uses the same font as what is used by dialog boxes.

smaller-caption
Uses a smaller version of the caption font.

status-bar
Uses the same font as what is used by the status bar.

initial
Sets the property to its default value.

inherit
Inherits this property’s value from its parent item.

Browser Compatibilty

Demos

Have a code example of font? Submit a codepen.io demo and we'll showcase it here

to submit a demo.
CSS
×

Success!

Help @reference spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 4.26,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...