Typography

Tailwind CSS text-4xl Class

The text-4xl utility class generates the following CSS when applied to an element.

CSS Output

CSS
.text-4xl {
  font-size: 2.25rem; /* 36px */
  line-height: 2.5rem; /* 40px */
}

Variants

Use these variant prefixes to apply text-4xl conditionally:

responsive:text-4xlhover:text-4xlfocus:text-4xl

Use It

HTML
<h1 class="text-4xl font-extrabold">
  Hero Headline
</h1>

Understanding text-4xl

The Tailwind CSS text-4xl utility applies font-size: 2.25rem; /* 36px */ to an element when added to its class attribute. It sets the font size to 36px with a 40px line height. A large display size for hero sections, landing pages, and dramatic visual impact.

This utility is part of Tailwind's Typography module, designed for styling text with appropriate sizes, weights, spacing, alignment, and decorations. In Tailwind's utility-first workflow, you add text-4xl directly to your HTML elements rather than writing custom CSS. This approach accelerates development and keeps styles co-located with your markup, making it easy to see exactly how each element is styled at a glance.

Common responsive variants include sm:text-4xl, md:text-4xl, lg:text-4xl, and xl:text-4xl, allowing different behavior at each breakpoint. State variants like hover:text-4xl and focus:text-4xl enable interactive styling without any JavaScript. You can also combine multiple variants for fine-grained control over when the utility applies.

This class works well alongside `text-3xl`, `text-2xl`, `text-xl`, `font-extrabold` to build complete, production-ready interfaces. Tailwind's tree-shaking ensures only utilities you actually use appear in your final CSS bundle, keeping file sizes minimal. Browser support for the underlying CSS is excellent across Chrome, Firefox, Safari, and Edge.

Related Classes

Explore More Tailwind Classes

Browse our complete reference of 321 Tailwind CSS utility classes with CSS output, variants, and examples.