Tailwind CSS tutorial #18: Font Smoothing
Shubhi✨

Shubhi✨ @fromshubhi

About: Software Engineer

Location:
Bengaluru, India
Joined:
Jul 25, 2022

Tailwind CSS tutorial #18: Font Smoothing

Publish Date: Nov 21 '22
10 3

In the article, we will go into detail on how to use font-smoothing.

Font smoothing

Format

font-{antialiased | subpixel-antialiased }

Alignment Tailwind Class CSS Property
Antialiased antialiased -webkit-font-smoothing: antialiased,-moz-osx-font-smoothing: grayscale;
Subpixel-antialiased subpixel-antialiased -webkit-font-smoothing: auto,-moz-osx-font-smoothing: auto;

Antialiased

This utility is to render text using grayscale antialiasing.

Subpixel-antialiased

This utility is to render text using subpixel antialiasing.

Note: This class does not show any effect.

Code

<ul class="container mx-auto leading-none divide-y divide-gray-400 divide-dotted" style="font-family: Raleway">
  <li class="flex items-center justify-between px-4 py-2">
    <div>
      <div class="antialiased text-5xl align-middle mb-2">Hello World</div>
    </div>
    <div class="text-xs font-semibold font-mono whitespace-nowrap px-2 py-1 ml-5 rounded text-white bg-pink-500 rounded-2">antialiased   </div>
  </li>
  <li class="flex items-center justify-between px-4 py-2">
    <div>
      <div class="subpixel-antialiased  text-5xl align-middle mb-2">Hello World</div>
    </div>
    <div class="text-xs font-semibold font-mono whitespace-nowrap px-2 py-1 ml-5 rounded text-white bg-pink-500 rounded-2">subpixel-antialiased   </div>
  </li>
</ul>
Enter fullscreen mode Exit fullscreen mode

Full code:
The overall code will be attached to repo link.

Overall Output
Image description

Resources:
tailwind.css

Thank you for reading :), To learn more, check out my blogs on Flex Direction, Hackathons and Flex Wrap.
If you liked this article, consider following me on Dev.to for my latest publications. You can reach me on Twitter.

Keep learning! Keep coding!! 💛

Comments 3 total

  • Pradumna Saraf
    Pradumna SarafNov 22, 2022

    Good one!

  • Marco Cordero
    Marco CorderoOct 16, 2024

    Hi. Sorry but, why is there a whole "article" dedicated to this specific Tailwind class when it covers the same if not less than the original tailwind reference?

    I'd be interesting if you explained when or why to use it or the background/motivation behind the class

Add comment