Tailwind Font Sizes
This article will cover how Tailwind Font Sizes can managed, and it will highlight the range of classes that developers can employ to adjust and manipulate font sizes in their projects.
The “font-size” class in Tailwind CSS allows us to easily set the font size of an HTML element and makes it easy to adjust font size for various screen sizes and devices.
In Tailwind CSS, you can easily set font sizes using a variety of pre-defined utility classes.
It’s an alternative to the CSS font-size property.
Tailwind Font size classes
When designing an interface, Tailwind CSS provides default font sizes.
The fontSize theme configuration defines the default font sizes as listed below.
Classes | Overview |
text-xs | This class is used to set the font size to 0.75rem (12px) which is extra small. |
text-sm | It’s equivalent to CSS font-size 0.875rem (14px). |
text-base | This is equal to CSS font-size 1rem (16px). This is the default class. |
text-lg | This class applies the same styles as CSS font-size 1.125rem (18px). |
text-xl | This class is used to set the font size to 1.25rem (20px) which is extra large. |
text-2xl | It’s equivalent to CSS font-size 1.5rem (24px). |
text-3xl | The font size is set to 1.875rem (30px) using this class. |
text-4xl | In this case, the font size is set to 2.25rem (36px). |
text-5xl | It’s equivalent to CSS font-size 3rem (48px). |
text-6xl | Using this class, the font size is set to 3.75rem (60px). |
text-7xl | This class is used to set the font size to 4.5rem (72px) which is extra large. |
text-8xl | The font size is set to 6rem (96px) using this class. |
text-9xl | It’s equivalent to CSS font-size 8rem (128px). |
Syntax
<element class="text-size">....</element>
To illustrate the font-size property, let’s take a look at the following example which makes use of some of the classes defined above:
Example: 
In below example, a few Tailwind font size classes are used for demonstration: