Tailwind CSS Letter-spacing
The letter-spacing utility class in Tailwind CSS allows you to adjust the spacing between characters in text.
Tailwind Letter Spacing
The letter-spacing
utility class in Tailwind CSS allows you to adjust the spacing between characters in text. With Tailwind's letter-spacing class, you can increase or decrease the spacing between letters to achieve the desired typography style.
How to apply Tailwind Letter Spacing
To apply letter spacing to an element, you can use the tracking-{amount}
utility class, where {amount}
represents the spacing value.
tracking-tighter
: Applies tighter letter spacing.tracking-tight
: Applies tight letter spacing.tracking-normal
: Applies normal letter spacing.tracking-wide
: Applies wide letter spacing.tracking-wider
: Applies even wider letter spacing.tracking-widest
: Applies the widest letter spacing.
<div class="tracking-tighter">Lorem ipsum dolor sit amet.</div><div class="tracking-widest">Lorem ipsum dolor sit amet.</div>
Preview
Lorem ipsum dolor sit amet.
Lorem ipsum dolor sit amet.
🎯 Use Cases for Tailwind Letter Spacing
1. Headings & Titles Tight or wide spacing can elevate the appearance of headers:
<h2 class="text-4xl tracking-wider font-bold uppercase">Our Services</h2>
Preview
Our Services
Wider spacing makes headings feel more elegant and prominent.
2. Buttons & UI Elements
Improved readability and style in smaller components:
<button class="tracking-wide uppercase text-sm px-4 py-2 bg-blue-600 text-white"> Submit</button>
Preview
3. Small Caps or Uppercase Text
All-caps text often benefits from increased spacing to prevent it from looking cramped:
<span class="uppercase tracking-widest text-xs text-gray-500">Tagline Here</span>
Preview
4. Hero Text & Marketing Copy
Stylized letter spacing adds visual interest in key messaging:
<h1 class="text-5xl tracking-tight leading-tight">Welcome to Our World</h1>
Preview
Welcome to Our World
Responsive Tailwwind Letter Spacing
Tailwind CSS allows you to apply letter spacing classes responsively at different breakpoints. To use responsive letter spacing classes, you can append the breakpoint prefix to the utility class. For example, md:tracking-wide
applies wider letter spacing starting from the medium breakpoint and above.
<p class="tracking-normal md:tracking-wide">Lorem ipsum dolor sit amet.</p>
In the above example, the letter spacing is set to normal by default (tracking-normal)
, but starting from the medium breakpoint and above, the letter spacing is changed to wider (md:tracking-wide)
.
Tailwind Letter Spacing Class Table
Class | Properties |
---|---|
tracking-tighter | letter-spacing: -0.05em; |
tracking-tight | letter-spacing: -0.025em; |
tracking-normal | letter-spacing: 0em; |
tracking-wide | letter-spacing: 0.025em; |
tracking-wider | letter-spacing: 0.05em; |
tracking-widest | letter-spacing: 0.1em; |
✨ What's Next?
Windframe Tailwind blocks
Windframe is a drag and drop builder for rapidly building tailwind css websites and UIs
Start building stunning tailwind UIs!
