Utilities for controlling the font smoothing of an element.
Use the subpixel-antialiased
utility to render text using subpixel antialiasing.
The quick brown fox jumps over the lazy dog.
<p class="subpixel-antialiased ...">The quick brown fox ...</p>
The quick brown fox jumps over the lazy dog.
<p class="antialiased ...">The quick brown fox ...</p>
To control the font smoothing of an element at a specific breakpoint, add a {screen}:
prefix to any existing font smoothing utility. For example, use md:antialiased
to apply the antialiased
utility at only medium screen sizes and above.
<p class="antialiased sm:subpixel-antialiased md:antialiased ...">
The quick brown fox jumps over the lazy dog.
</p>
For more information about Tailwind’s responsive design features, check out the Responsive Design documentation.
By default, only responsive variants are generated for font smoothing utilities.
You can control which variants are generated for the font smoothing utilities by modifying the fontSmoothing
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: {
// ...
+ fontSmoothing: ['hover', 'focus'],
}
}
}
If you don't plan to use the font smoothing utilities in your project, you can disable them entirely by setting the fontSmoothing
property to false
in the corePlugins
section of your config file:
// tailwind.config.js
module.exports = {
corePlugins: {
// ...
+ fontSmoothing: false,
}
}