Typography
Font Smoothing
Utilities for controlling the font smoothing of an element.
Quick reference
Class | Properties |
---|---|
antialiased | -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; |
subpixel-antialiased | -webkit-font-smoothing: auto; -moz-osx-font-smoothing: auto; |
Basic usage
Applying font smoothing
Use the subpixel-antialiased
utility to render text using subpixel antialiasing and the antialiased
utility to render text using grayscale antialiasing.
<p class="subpixel-antialiased ...">The quick brown fox ...</p>
<p class="antialiased ...">The quick brown fox ...</p>
Applying conditionally
Hover, focus, and other states
Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use hover:subpixel-antialiased
to only apply the subpixel-antialiased
utility on hover.
<p class="antialiased hover:subpixel-antialiased">
<!-- ... -->
</p>
For a complete list of all available state modifiers, check out the Hover, Focus, & Other States documentation.
Breakpoints and media queries
You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use md:subpixel-antialiased
to apply the subpixel-antialiased
utility at only medium screen sizes and above.
<p class="antialiased md:subpixel-antialiased">
<!-- ... -->
</p>
To learn more, check out the documentation on Responsive Design, Dark Mode and other media query modifiers.