Skip to content

font-weight

Utilities for controlling the font weight of an element.

Quick reference

ClassStyles
font-thinfont-weight: 100;
font-extralightfont-weight: 200;
font-lightfont-weight: 300;
font-normalfont-weight: 400;
font-mediumfont-weight: 500;
font-semiboldfont-weight: 600;
font-boldfont-weight: 700;
font-extraboldfont-weight: 800;
font-blackfont-weight: 900;
font-(<custom-property>)font-weight: var(<custom-property>);
font-[<value>]font-weight: <value>;

Source: https://tailwindcss.com/guide/font-weight

Examples

Basic example

Use utilities like font-thin and font-bold to set the font weight of an element:

html
<!-- [!code classes:font-light,font-normal,font-medium,font-semibold,font-bold] -->
<p class="font-light ...">The quick brown fox ...</p>
<p class="font-normal ...">The quick brown fox ...</p>
<p class="font-medium ...">The quick brown fox ...</p>
<p class="font-semibold ...">The quick brown fox ...</p>
<p class="font-bold ...">The quick brown fox ...</p>

Using a custom value

You can use arbitrary values to set a custom font weight:

html
<p class="font-[1000] ...">Extra heavy</p>

Responsive design

html
<p class="font-normal md:font-bold ..."></p>

Customizing your theme

You can customize the font weights in your theme by adding entries to the fontWeight section of your tailwind.config.js file:

js
module.exports = {
  theme: {
    extend: {
      fontWeight: {
        'extrablack': '1000',
        'ultra': '950',
      }
    }
  }
}

Released under the MIT License.