Class reference

Font Weight - 图1

Usage

Control the font weight of an element using the .font-{weight} utilities.

Font Weight - 图2

Responsive

To control the font weight of an element at a specific breakpoint, add a {screen}: prefix to any existing font weight utility. For example, use md:font-bold to apply the font-bold utility at only medium screen sizes and above.

For more information about Tailwind’s responsive design features, check out the Responsive Design documentation.

Font Weight - 图3

all

Font Weight - 图4

sm

Font Weight - 图5

md

Font Weight - 图6

lg

Font Weight - 图7

xl

Font Weight - 图8

Hover

To control the font weight of an element on hover, add the hover: prefix to any existing style and decoration utility. For example, use hover:font-bold to apply the font-bold utility on hover.

Font Weight - 图9

Hover utilities can also be combined with responsive utilities by adding the responsive {screen}: prefix before the hover: prefix.

  1. <a href="#" class="... md:font-normal md:hover:font-bold ...">Link</a>

Focus

To control the font weight of an element on focus, add the focus: prefix to any existing style and decoration utility. For example, use focus:font-bold to apply the font-bold utility on focus.

Font Weight - 图10

Focus utilities can also be combined with responsive utilities by adding the responsive {screen}: prefix before the focus: prefix.

  1. <input class="... md:font-normal md:focus:font-bold ..." value="Focus me">

Customizing

Responsive and State Variants

By default, only responsive, hover and focus variants are generated for font weight utilities.

You can control which variants are generated for the font weight utilities by modifying the fontWeights property in the modules section of your Tailwind config file.

For example, this config will also generate variants:

Font Weight - 图11

Disabling

If you don’t plan to use the font weight utilities in your project, you can disable them entirely by setting the fontWeights property to false in the modules section of your config file:

Font Weight - 图12