Skip to content

Typography

Classes for text management: size, color, alignment, font weight, and more.

ClassSizeLine Height
.text-2xs10px12px
.text-xs12px16px
.text-sm14px20px
.text-base16px24px
.text-lg18px28px
.text-xl20px28px
.text-2xl24px32px
<div class="flex flex-col gap-2">
<p class="text-2xs">Very small (10px)</p>
<p class="text-xs">Small (12px)</p>
<p class="text-sm">Smaller (14px)</p>
<p class="text-base">Base (16px)</p>
<p class="text-lg">Large (18px)</p>
<p class="text-xl">Very large (20px)</p>
<p class="text-2xl">Double (24px)</p>
</div>
<div class="flex flex-col gap-2">
<span class="text-primary">Primary</span>
<span class="text-secondary">Secondary</span>
<span class="text-success">Success</span>
<span class="text-danger">Danger</span>
<span class="text-warning">Warning</span>
<span class="text-info">Info</span>
</div>
<div class="flex flex-col gap-2">
<span class="text-gray-50">50 (very light)</span>
<span class="text-gray-100">100</span>
<span class="text-gray-200">200</span>
<span class="text-gray-300">300</span>
<span class="text-gray-400">400</span>
<span class="text-gray-500">500 (gray)</span>
<span class="text-gray-600">600</span>
<span class="text-gray-700">700</span>
<span class="text-gray-800">800</span>
<span class="text-gray-900">900 (very dark)</span>
</div>
<div class="flex gap-4">
<span class="text-red-500">Red</span>
<span class="text-blue-500">Blue</span>
<span class="text-green-500">Green</span>
<span class="text-yellow-500">Yellow</span>
</div>
<!-- Special -->
<div class="flex gap-4">
<span class="text-white" style="background: var(--u-gray-900); padding: 0 0.5rem">White</span>
<span class="text-black">Black</span>
<span class="text-none">Transparent</span>
</div>
<a href="#" class="text-gray-600 hover:text-primary-500">
Link with color change on hover
</a>
ClassCSS Property
.text-lefttext-align: left
.text-centertext-align: center
.text-righttext-align: right
.text-justifytext-align: justify
.text-starttext-align: start
.text-endtext-align: end
<div class="border p-4">
<p class="text-left">Left aligned</p>
<p class="text-center">Center aligned</p>
<p class="text-right">Right aligned</p>
<p class="text-justify">Justified</p>
</div>
ClassValueDescription
.font-thin100Thin
.font-extralight200Extra Light
.font-light300Light
.font-normal400Regular
.font-medium500Medium
.font-semibold600Semi Bold
.font-bold700Bold
.font-extrabold800Extra Bold
.font-black900Black
<div class="flex flex-col gap-2">
<span class="font-thin">Thin (100)</span>
<span class="font-extralight">Extra Light (200)</span>
<span class="font-light">Light (300)</span>
<span class="font-normal">Regular (400)</span>
<span class="font-medium">Medium (500)</span>
<span class="font-semibold">Semi Bold (600)</span>
<span class="font-bold">Bold (700)</span>
<span class="font-extrabold">Extra Bold (800)</span>
<span class="font-black">Black (900)</span>
</div>
<p class="italic">Italic</p>
<p class="underline">Underlined</p>
<p class="underline">Underlined</p>
<p class="font-caps">UPPERCASE</p>
ClassHeight
.line-height-2xs12px
.line-height-xs16px
.line-height-sm20px
.line-height-base24px
.line-height-lg28px
.line-height-xl28px
.line-height-2xl32px
<p class="line-height-base">Base line height for comfortable reading</p>
ClassCSS Property
.text-topvertical-align: top
.text-middlevertical-align: middle
.text-bottomvertical-align: bottom
.text-baselinevertical-align: baseline
<div class="text-lg">
<span class="text-top">Top</span>
<span class="text-middle">Middle</span>
<span class="text-bottom">Bottom</span>
<span class="text-baseline">Baseline</span>
</div>
<!-- No wrap -->
<p class="nowrap">Text without line breaks</p>
<!-- Preserve whitespace -->
<p class="pre-wrap">Preserves spaces and line breaks</p>
<!-- Ellipsis -->
<div class="w-64 truncate">
Very long text that will be truncated and replaced with an ellipsis...
</div>
<!-- Truncation without ellipsis -->
<div class="w-64 overflow-hidden nowrap">Truncated text</div>
<p class="break-word">Longwordthatdoesnotbreak</p>
<!-- No markers -->
<ul class="list-style-none">
<li>Item 1</li>
<li>Item 2</li>
</ul>
<!-- Reset styles -->
<ul class="list-reset">
<li>Item without markers</li>
</ul>
<article>
<h1 class="text-2xl font-bold mb-4">Article Title</h1>
<p class="text-gray-600 text-sm mb-6">Published March 26, 2024</p>
<p class="text-base line-height-base">Main article text...</p>
</article>
<div class="border rounded-lg p-4">
<h3 class="text-lg font-bold mb-2">Product Name</h3>
<p class="text-gray-600 text-sm mb-4">Short product description</p>
<div class="flex justify-between items-center">
<span class="text-xl font-bold text-primary-500">$99.99</span>
<button class="text-sm text-primary-500 hover:underline">Add to Cart</button>
</div>
</div>
<nav class="flex items-center gap-6">
<a href="/" class="text-lg font-bold">Logo</a>
<a href="/about" class="text-gray-600 hover:text-primary-500">About</a>
<a href="/products" class="text-gray-600 hover:text-primary-500">Products</a>
<a href="/contact" class="text-gray-600 hover:text-primary-500">Contact</a>
</nav>
<blockquote class="border-l-4 border-primary-500 pl-4 italic">
<p class="text-lg text-gray-700">&ldquo;Quote from a famous person&rdquo;</p>
<footer class="text-sm text-gray-500 mt-2">&mdash; Author</footer>
</blockquote>
<p class="text-xs text-gray-500">* Required field</p>
<div class="bg-success text-white p-4 rounded">
<p class="font-bold mb-1">Success!</p>
<p class="text-sm">Operation completed successfully</p>
</div>
<a href="#" class="text-primary-500 hover:underline">
Link with underline on hover
</a>
<p>
Use
<code style="background: var(--u-gray-100); padding: 0.25rem 0.5rem; border-radius: 0.25rem; font-size: 0.875rem">npm install</code>
to install the package
</p>
<pre style="background: var(--u-gray-900); color: var(--u-gray-100); padding: 1rem; border-radius: 0.25rem; font-size: 0.875rem; overflow-x: auto">
<code>npm install ustatic-css</code>
</pre>
Classes
text-2xs, text-xs, text-sm, text-base, text-lg, text-xl, text-2xl
CategoryClasses
Semantictext-primary, text-secondary, text-success, text-danger, text-warning, text-info
Graytext-gray-50, text-gray-100text-gray-900
Colorstext-red-*, text-blue-*, text-green-*, text-yellow-*
Specialtext-white, text-black, text-none
Hoverhover:text-{color}
Classes
text-left, text-center, text-right, text-justify, text-start, text-end
Classes
font-thin, font-extralight, font-light, font-normal, font-medium, font-semibold, font-bold, font-extrabold, font-black
Classes
italic, underline, font-caps, truncate
Classes
line-height-2xs, line-height-xs, line-height-sm, line-height-base, line-height-lg, line-height-xl, line-height-2xl
Classes
text-top, text-middle, text-bottom, text-baseline
Classes
nowrap (nowrap), pre-wrap (pre-wrap), truncate, text-ellipsis, break-word, list-style-none, list-reset
font-family-inherit, font-size-inherit, font-caps
text-decoration-none, text-style-clear
text-text-top, text-text-bottom, text-sub, text-super
Alignment aliases: left-align, center, right-align, justify