Utilities for controlling the font weight of an element.
<p class="font-thin ...">The quick brown fox ...</p>
<p class="font-extralight ...">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>
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.
<p class="font-normal md:font-bold ...">The quick brown fox jumped over the lazy dog.</p>
For more information about Tailwind's responsive design features, check out the Responsive Design documentation.
By default, Tailwind provides 10 font-weight
utilities. You change, add, or remove these by editing the theme.fontWeight
section of your Tailwind config.
// tailwind.config.js
module.exports = {
theme: {
fontWeight: {
- hairline: 100,
+ 'extra-light': 100,
- thin: 200,
light: 300,
normal: 400,
medium: 500,
- semibold: 600,
bold: 700,
- extrabold: 800,
+ 'extra-bold': 800,
black: 900,
}
}
}
By default, only responsive variants are generated for font weight utilities.
You can control which variants are generated for the font weight utilities by modifying the fontWeight
property in the variants
section of your tailwind.config.js
file.
For example, this config will also generate hover and focus variants:
// tailwind.config.js
module.exports = {
variants: {
extend: {
// ...
+ fontWeight: ['hover', 'focus'],
}
}
}
If you don't plan to use the font weight utilities in your project, you can disable them entirely by setting the fontWeight
property to false
in the corePlugins
section of your config file:
// tailwind.config.js
module.exports = {
corePlugins: {
// ...
+ fontWeight: false,
}
}