Class reference
Usage
Control the font weight of an element using the .font-{weight}
utilities.
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.
all
sm
md
lg
xl
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.
Hover utilities can also be combined with responsive utilities by adding the responsive {screen}:
prefix before the hover:
prefix.
<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.
Focus utilities can also be combined with responsive utilities by adding the responsive {screen}:
prefix before the focus:
prefix.
<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:
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: