Font Weight
Class reference
Usage
Control the font weight of an element using the .font-{weight}
utilities.
.font-hairline
The quick brown fox jumped over the lazy dog.
.font-thin
The quick brown fox jumped over the lazy dog.
.font-light
The quick brown fox jumped over the lazy dog.
.font-normal
The quick brown fox jumped over the lazy dog.
.font-medium
The quick brown fox jumped over the lazy dog.
.font-semibold
The quick brown fox jumped over the lazy dog.
.font-bold
The quick brown fox jumped over the lazy dog.
.font-extrabold
The quick brown fox jumped over the lazy dog.
.font-black
The quick brown fox jumped over the lazy dog.
<p class="font-hairline ...">The quick brown fox ...</p>
<p class="font-thin ...">The quick brown fox ...</p>
<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>
<p class="font-extrabold ...">The quick brown fox ...</p>
<p class="font-black ...">The quick brown fox ...</p>
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.
The quick brown fox jumped over the lazy dog.
The quick brown fox jumped over the lazy dog.
The quick brown fox jumped over the lazy dog.
The quick brown fox jumped over the lazy dog.
The quick brown fox jumped over the lazy dog.
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.
<div class="text-center text-blue-dark">
<a href="#" class="font-normal hover:font-bold">Hover over this link</a>
</div>
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.
<input class="font-normal focus:font-bold ..." value="Focus me">
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: