CSS font-weight Property

The font-weight property controls how light or bold text appears by selecting a weight from the available font family.

Font weight can be specified using keywords such as normal and bold, relative values such as bolder and lighter, or numbers from 1 to 1000. The available weights depend on the selected font, and variable fonts may support a continuous range of weights.

font-weight Syntax

The font-weight property accepts an absolute keyword, a relative keyword, or a numeric value.

Basic Syntax

selector {
  font-weight: normal;
}

Bold Text

selector {
  font-weight: bold;
}

Numeric Weight

selector {
  font-weight: 600;
}

Relative Weight

selector {
  font-weight: bolder;
}

Variable Font Weight

selector {
  font-weight: 575;
}

CSS-Wide Keywords

.example {
  font-weight: inherit;
}
.example {
  font-weight: initial;
}
.example {
  font-weight: unset;
}
.example {
  font-weight: revert;
}
.example {
  font-weight: revert-layer;
}

Numeric values are unitless. Values below 1 or above 1000 are invalid, and a weight does not require a font to provide a matching face.

Property Values

The property supports the following values.

Value Description
normal Requests the normal font weight, equivalent to 400.
bold Requests a bold font weight, equivalent to 700.
bolder Requests a heavier weight relative to the inherited font weight.
lighter Requests a lighter weight relative to the inherited font weight.
1 to 1000 Specifies an absolute numeric font weight, including intermediate values.

Property Characteristics

Characteristic Value
Initial value normal (400)
Inherited Yes
Applies to All elements and text
Computed value An absolute numeric weight
Animation type By computed value type (number)
Percentages Not applicable

The computed weight does not necessarily match an available font face. The browser selects an appropriate face according to font matching rules.

How It Works

When a font weight is requested, the browser looks for a suitable face within the selected font family.

Select a Font Family

.text {
  font-family: Arial, sans-serif;
}

Request a Weight

.text {
  font-weight: 700;
}

Font Matching

If the family provides the requested weight, the browser can use that face. Otherwise, it searches for a suitable available weight according to CSS font matching rules.

Font Weight and Appearance

Heavier weights generally have thicker strokes, but the exact appearance depends on the typeface design. Two fonts using the same numeric weight can look noticeably different.

Weight Does Not Change Font Size

.heading {
  font-size: 32px;
  font-weight: 700;
}

The font-size property controls text size, while font-weight selects its weight. A weight change may still affect text width or spacing because different font faces can have different metrics.

The normal Value

The normal value requests the standard font weight, equivalent to numeric weight 400.

Basic Example

.paragraph {
  font-weight: normal;
}

Numeric Equivalent

.paragraph {
  font-weight: 400;
}

Reset Bold Text

.card {
  font-weight: bold;
}
.card .description {
  font-weight: normal;
}

Typical Uses

Normal weight is commonly used for paragraphs, labels, navigation text, and other content that does not require additional emphasis.

Important Consideration

The normal value requests weight 400 even when the parent element uses a different weight. It does not mean "use the parent's weight."

The bold Value

The bold value requests a heavier font weight, equivalent to numeric weight 700.

Basic Example

.heading {
  font-weight: bold;
}

Numeric Equivalent

.heading {
  font-weight: 700;
}

Bold Navigation Labels

.navigation-label {
  font-weight: bold;
}

Bold Text Within a Paragraph

<p>Use the <strong>Save</strong> button to keep your changes.</p>

The HTML <strong> element indicates strong importance. Browsers commonly display it in bold, but its meaning is separate from the CSS weight.

Visual Bold Without Semantic Emphasis

.section-label {
  font-weight: bold;
}

Important Consideration

Use <strong> when the text has strong importance. Use font-weight when only its visual appearance needs to change.

Numeric Font Weights

Numeric font weights provide more precise control than the normal and bold keywords.

Traditional Weight Values

Weight Common Description
100 Thin
200 Extra Light
300 Light
400 Normal or Regular
500 Medium
600 Semi Bold
700 Bold
800 Extra Bold
900 Black or Heavy

These descriptions are common naming conventions, not guarantees of identical appearance across fonts.

Basic Numeric Examples

.light-text {
  font-weight: 300;
}
.regular-text {
  font-weight: 400;
}
.medium-text {
  font-weight: 500;
}
.bold-text {
  font-weight: 700;
}

Intermediate Values

.heading {
  font-weight: 575;
}

Intermediate values are valid. Variable fonts can provide finer changes between weights when their supported range includes the requested value.

Fractional Values

.heading {
  font-weight: 425.5;
}

Fractional numeric values are valid, although the selected font may not provide a visually distinct weight for every value.

Extended Weight Range

.heading {
  font-weight: 950;
}

Values up to 1000 are valid, but the font must support the requested range for an exact weight to be available.

Important Consideration

Numeric values do not create additional font faces. If the requested weight is unavailable, the browser uses font matching and may synthesize a heavier appearance when permitted.

Relative Font Weights

The bolder and lighter keywords select weights relative to the inherited font weight.

The bolder Value

.parent {
  font-weight: 400;
}
.parent .emphasis {
  font-weight: bolder;
}

The child requests a heavier weight relative to the parent's computed weight.

The lighter Value

.parent {
  font-weight: 700;
}
.parent .secondary {
  font-weight: lighter;
}

The child requests a lighter weight relative to the parent's computed weight.

Relative Weight Calculation

Relative weights are resolved using the inherited weight and the CSS relative-weight mapping. They do not simply add or subtract 100.

Inherited Weight bolder lighter
100 to 349 400 100
350 to 549 700 100
550 to 899 900 400
900 to 1000 900 700

Nested Example

<div class="text-group">
  <p>Normal paragraph text.</p>
  <p class="stronger">Heavier paragraph text.</p>
  <p class="lighter">Lighter paragraph text.</p>
</div>
.text-group {
  font-weight: 400;
}
.text-group .stronger {
  font-weight: bolder;
}
.text-group .lighter {
  font-weight: lighter;
}

Important Consideration

The relative keywords are resolved to numeric computed values. They do not depend on which font faces are available, and the visible result may be affected by font matching.

Available Font Weights

Not every font family includes all possible weights. Some provide only regular and bold faces, while others contain several static weights or a variable weight range.

Requesting an Available Weight

.heading {
  font-family: Arial, sans-serif;
  font-weight: 700;
}

Requesting an Unavailable Weight

.heading {
  font-family: Arial, sans-serif;
  font-weight: 600;
}

If the family does not provide weight 600, the browser selects a suitable available face according to font matching rules.

Font Matching Behavior

CSS font matching generally follows these principles:

  • For requested weights between 400 and 500, the browser first looks toward 500, then lighter weights, then heavier weights.
  • For requested weights below 400, the browser searches lighter weights first, followed by heavier weights.
  • For requested weights above 500, the browser searches heavier weights first, followed by lighter weights.

Font Weight Does Not Guarantee Thickness

Different typefaces can have different stroke thicknesses at the same numeric weight. A weight of 600 in one font may appear heavier than 700 in another.

Important Consideration

Test the actual font files used by your website. Do not assume that every numeric value produces a distinct appearance.

Variable Fonts

Variable fonts can provide a continuous range of weights within a single font file.

Basic Variable Font Example

.variable-heading {
  font-family: "Example Variable", sans-serif;
  font-weight: 575;
}

Different Weights

.variable-light {
  font-weight: 250;
}
.variable-medium {
  font-weight: 525;
}
.variable-heavy {
  font-weight: 850;
}

Weight Animation

.animated-heading {
  font-weight: 400;
  transition: font-weight 300ms ease;
}
.animated-heading:hover {
  font-weight: 800;
}

With a suitable variable font, intermediate weights can be displayed during the transition.

Respect Reduced Motion

@media (prefers-reduced-motion: reduce) {
  .animated-heading {
    transition: none;
  }
}

Important Consideration

A variable font must support the requested weight range. Values outside its range are matched to an available weight rather than producing unlimited changes.

Using font-weight with @font-face

The font-weight descriptor in an @font-face rule identifies the weight or weight range provided by a font resource.

Regular Font File

@font-face {
  font-family: "Example Sans";
  src: url("/fonts/example-regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

Bold Font File

@font-face {
  font-family: "Example Sans";
  src: url("/fonts/example-bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

Apply the Font Family

.body-text {
  font-family: "Example Sans", sans-serif;
  font-weight: 400;
}
.heading {
  font-family: "Example Sans", sans-serif;
  font-weight: 700;
}

Variable Font Weight Range

@font-face {
  font-family: "Example Variable";
  src: url("/fonts/example-variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

Using the Variable Font

.variable-heading {
  font-family: "Example Variable", sans-serif;
  font-weight: 650;
}

Important Consideration

The font-weight descriptor in @font-face describes the resource's available weights. The font-weight property on an element requests a weight for displaying its text.

Declare only weights and ranges actually supported by the font files.

Synthetic Bold Text

When a requested bold face is unavailable, browsers may generate a heavier appearance from an existing font face.

Allow Normal Font Matching

.heading {
  font-weight: bold;
}

Disable Synthetic Bold

.heading {
  font-weight: bold;
  font-synthesis-weight: none;
}

Using font-synthesis

.heading {
  font-weight: bold;
  font-synthesis: none;
}

The font-synthesis shorthand controls multiple types of synthesized font styling, while font-synthesis-weight specifically controls synthetic bolding.

Why Disable Synthetic Bold?

Synthetic bolding may produce a different appearance from a properly designed bold font face. Disabling it can help preserve a typeface's intended design.

Important Consideration

Disabling synthetic bold does not make an unavailable bold face appear. If the font lacks the requested weight, text may remain lighter than expected.

The font Shorthand

The font shorthand can set font weight together with font size, line height, family, and other font characteristics.

Longhand Example

.heading {
  font-weight: 700;
  font-size: 28px;
  font-family: Arial, sans-serif;
}

Shorthand Equivalent

.heading {
  font: 700 28px Arial, sans-serif;
}

With Line Height

.heading {
  font: bold 28px/1.3 Arial, sans-serif;
}

Shorthand Reset Behavior

.heading {
  font-weight: 700;
  font: 24px Arial, sans-serif;
}

The later font shorthand resets the weight to normal because no weight is included.

Preserve the Weight

.heading {
  font: 700 24px Arial, sans-serif;
}

Important Consideration

Use font-weight when changing only the weight. Use the font shorthand when several font properties need to be defined together.

Comparison with font-variation-settings

The font-weight property provides high-level weight control, while font-variation-settings allows direct access to a variable font's weight axis.

High-Level Weight Control

.heading {
  font-weight: 650;
}

Low-Level Weight Axis

.heading {
  font-variation-settings: "wght" 650;
}

Comparison

Feature font-weight font-variation-settings
Purpose Requests a font weight. Controls named variation axes directly.
Static fonts Supported. Does not provide variable-axis control for static fonts.
Variable fonts Supported. Supported.
Syntax font-weight: 650; font-variation-settings: "wght" 650;
Recommended for ordinary weight control Yes. Usually unnecessary.

Conflicting Settings

.heading {
  font-weight: 400;
  font-variation-settings: "wght" 800;
}

When the selected variable font supports the "wght" axis, the low-level variation setting can override the axis value normally selected through font-weight.

Important Consideration

Prefer font-weight for normal typography. Use font-variation-settings for specialized variable font controls or custom axes.

Inheritance

The font-weight property is inherited. Child elements receive the parent's computed weight unless they specify another value.

Inherited Weight

.content {
  font-weight: 600;
}
<div class="content">
  <p>This paragraph inherits the weight.</p>
  <span>This span also inherits the weight.</span>
</div>

Override a Child Element

.content {
  font-weight: 600;
}
.content .regular-text {
  font-weight: 400;
}

Explicit Inheritance

.child {
  font-weight: inherit;
}

Reset to Initial Value

.child {
  font-weight: initial;
}

Relative Weight and Inheritance

.parent {
  font-weight: 400;
}
.parent .child {
  font-weight: bolder;
}

The child's relative value is resolved using the parent's computed numeric weight.

Important Consideration

Some HTML elements, including headings and <strong>, commonly have bold styles in the browser's default stylesheet. These styles can override an inherited weight.

font-weight Example

This example compares common numeric font weights and the normal and bold keywords.

HTML Example

<div class="font-weight-demo">
  <p class="weight-300">300 - Light Text</p>
  <p class="weight-400">400 - Regular Text</p>
  <p class="weight-500">500 - Medium Text</p>
  <p class="weight-600">600 - Semi Bold Text</p>
  <p class="weight-700">700 - Bold Text</p>
  <p class="weight-900">900 - Heavy Text</p>
  <p class="weight-normal">normal - Normal Text</p>
  <p class="weight-bold">bold - Bold Text</p>
</div>

CSS Example

.font-weight-demo {
  font-family: Arial, sans-serif;
}
.font-weight-demo p {
  margin: 0 0 12px;
  font-size: 22px;
  line-height: 1.4;
}
.font-weight-demo .weight-300 {
  font-weight: 300;
}
.font-weight-demo .weight-400 {
  font-weight: 400;
}
.font-weight-demo .weight-500 {
  font-weight: 500;
}
.font-weight-demo .weight-600 {
  font-weight: 600;
}
.font-weight-demo .weight-700 {
  font-weight: 700;
}
.font-weight-demo .weight-900 {
  font-weight: 900;
}
.font-weight-demo .weight-normal {
  font-weight: normal;
}
.font-weight-demo .weight-bold {
  font-weight: bold;
}
Browser Result

300 - Light Text

400 - Regular Text

500 - Medium Text

600 - Semi Bold Text

700 - Bold Text

900 - Heavy Text

normal - Normal Text

bold - Bold Text

The example uses Arial as the preferred font. Because Arial may not provide separate faces for every requested weight, some lines may appear identical or nearly identical.

For a demonstration of a continuous weight range, use a variable font that supports the desired weights.

Common Mistakes

Common mistakes involve invalid values, unsupported font weights, and confusion between visual boldness and semantic importance.

Using Percentage Values

.heading {
  font-weight: 70%;
}

This declaration is invalid. The property does not accept percentages.

Using Pixel Values

.heading {
  font-weight: 700px;
}

This declaration is invalid. Numeric font weights are unitless.

Using an Unsupported Keyword

.heading {
  font-weight: semibold;
}

This declaration is invalid. Use a numeric value such as 600.

Using a Value Outside the Valid Range

.heading {
  font-weight: 1200;
}

This declaration is invalid because numeric weights must be between 1 and 1000.

Assuming Every Weight Exists

A request for weight 500 does not guarantee that the font contains a separate medium face.

Assuming bolder Adds 100

The bolder keyword uses a defined relative-weight mapping rather than simply adding 100 to the inherited value.

Using Bold Styling for Meaning

CSS weight changes are visual. Use appropriate HTML elements when text needs semantic importance.

Forgetting font Shorthand Resets

A later font shorthand can reset the weight to normal if no weight is included.

Conflicting Variable Font Settings

A direct "wght" setting in font-variation-settings may override the corresponding high-level weight selection.

Important Considerations

Keep the following points in mind when using the font-weight property:

  • Purpose: Controls the requested weight of text.
  • Initial value: normal, equivalent to 400.
  • Inheritance: The property is inherited.
  • Applies to: All elements and text.
  • normal: Equivalent to numeric weight 400.
  • bold: Equivalent to numeric weight 700.
  • bolder: Selects a heavier weight relative to the inherited weight.
  • lighter: Selects a lighter weight relative to the inherited weight.
  • Numeric range: Values from 1 to 1000 are valid.
  • Intermediate values: Numeric weights are not limited to multiples of 100.
  • Font availability: The requested weight may not exist in the selected font family.
  • Font matching: Browsers select suitable available weights when an exact match is unavailable.
  • Variable fonts: May provide continuous weight ranges.
  • Static fonts: Usually provide a limited set of distinct weight faces.
  • Synthetic bold: Browsers may generate heavier text when a bold face is unavailable.
  • font-synthesis-weight: Can prevent synthetic bolding.
  • @font-face: The weight descriptor identifies available font weights.
  • font shorthand: Can set or reset the weight along with other font properties.
  • font-variation-settings: Provides direct access to the variable font "wght" axis.
  • Semantic HTML: Use <strong> for strong importance rather than relying on visual boldness alone.
  • Animation: Numeric weights can be interpolated, with the visible result depending on font support.
  • Browser support: The property is widely supported.

Use font-weight to establish clear visual hierarchy and emphasis. Choose weights supported by the selected font and test their appearance across headings, paragraphs, navigation, and other interface text.

Browser Support

The CSS font-weight property is Widely available across modern browsers, including Chrome, Edge, Firefox, and Safari.

Traditional keyword and numeric weights have long-standing support. Intermediate numeric values and smooth weight transitions depend on the selected font and the browser's variable font capabilities.

Basic Example

.heading {
  font-weight: 700;
}

Variable Font Example

.variable-heading {
  font-weight: 575;
}

Font Availability

Browser support for font-weight does not guarantee that every font provides all possible weights. Unsupported weights are handled through font matching and, when allowed, font synthesis.

For current compatibility information, visit Can I Use? and search for font-weight.

Specifications

The font-weight property is defined in the CSS Fonts Module, which describes font weight selection, matching, and related font characteristics.

CSS Fonts Module Level 4: font-weight

The module also defines font family selection, font styles, variable font controls, and font matching behavior.

CSS Fonts Module Level 4

For additional explanations and examples, see MDN Web Docs.

MDN Web Docs: font-weight