Text✨ Premium

Letter Spacing

A bold text element transitions its letter spacing from 0 to 8 px on hover via native CSS — zero JavaScript, applicable to any text element.

CSSHoverSpacing

You'll get access to the interactive demo with a free account.

This effect is part of Effect.Labs — 811 vanilla effects, some free, some premium. Text has 56 effects, including 4 free. Explore the category →

3 usage examples

Full-screen display title — Landing page or portfolio — Letter Spacing example 1

① Full-screen display title — Landing page or portfolio

WhenThe visitor arrives on a home page and discovers a large bold uppercase title — hover makes the spacing explode, revealing the brand's energy.
WhyOn a 5–8 rem body size, the 8 px expansion is highly visible and creates a spectacular airy effect with no layout shift when the container has a fixed width.
Settingsfont-size: 5rem, target spacing 18px, transition .5s ease-out for smooth deceleration.
Horizontal navigation — Site header or main menu — Letter Spacing example 2

② Horizontal navigation — Site header or main menu

WhenNavigation items expand slightly on hover to signal interactivity without a distracting animation.
WhyLetter-spacing hover on nav items is a classic high-end web design pattern. The expansion stays contained (3–4 px) to avoid shifting adjacent items.
Settingsfont-size: .75rem, font-weight: 600, target spacing 3px, transition .28s for responsiveness.
Gallery filter labels — Portfolio, shop or dataviz — Letter Spacing example 3

③ Gallery filter labels — Portfolio, shop or dataviz

WhenOn a portfolio or shop page, visitors hover category filters to refine their selection — letter expansion immediately signals that each label is clickable, without any extra icon or underline.
WhyFilter labels are already intended to be interactive: the effect confirms that intent visually. On compact uppercase text (.7–.8 rem), even 3–4 px of expansion creates a clear, elegant interactivity cue.
Settingsfont-size: .72rem, font-weight: 700, target spacing 4px, transition .25s for responsive clickable elements.

How it works

The effect stacks two classes on the same <span>. .demo-text sets the typography (2.5 rem, weight 800, initial spacing -.02em). .text-spacing overrides that spacing to 0 and declares transition: letter-spacing .4s — the browser plans the interpolation with no JS involved. The rule .text-spacing:hover { letter-spacing: 8px } is the only target instruction: on hover, spacing grows from 0 to 8 px; when the cursor leaves, it returns to 0.

CSS interpolates letter-spacing natively. The implicit easing is ease (accelerate then decelerate). On Chromium 112+, the letter-spacing transition is GPU-accelerated with no layout repaint — the property is animated on the compositor thread. On Firefox and Safari, the engine re-renders the text block each frame, but the animation stays smooth at 60 fps for short strings. No requestAnimationFrame, no event listeners: the JS source is empty.

Accessibility

  • prefers-reduced-motion: absent from the code. If your audience includes motion-sensitive users, add @media (prefers-reduced-motion: reduce) { .text-spacing { transition: none } } in your stylesheet.
  • The effect is hover-only — not keyboard-accessible without modification. For keyboard navigation, add .text-spacing:focus { letter-spacing: 8px }.
  • Contrast: the code inherits color: #fff (body) on #0a0a0f background — ratio ≥ 21:1, WCAG AAA.
  • No aria attributes in the structure: the change is purely visual, no semantic state to communicate to screen readers.

Browser compatibility

CSS letter-spacing, transition, and :hover are universally supported since 2012. Zero dependencies.

Chrome 88+✓ Full
Firefox 87+✓ Full
Safari 14+✓ Full
Edge 88+✓ Full
Mobile iOS✓ No hover (touch only)
Android Chrome✓ No hover (touch only)

Without CSS transition support (very old browsers), the text jumps directly to the target spacing on hover — no error, no missing JS.

The code

HTML structure to paste into your page (CSS + JS available with a premium account):

index.html — structure
<div class="demo-preview">
  <span class="demo-text text-spacing">TEXT</span>
</div>
🔒 Unlock the full code — from €2.99 the first month

Full HTML + CSS + JS, copy-paste ready — with hundreds of premium effects.

Customize

Options passed to the API or data-* attributes:

Option / propertyDefaultEffect
letter-spacing (target) 8px The letter-spacing: 8px line in .text-spacing:hover — expansion amplitude. 3–4 px for nav items, 12–20 px for display titles.
transition duration .4s In transition: letter-spacing .4s on .text-spacing — .2s for instant snap-back, .6–.8s for elegant inertia.
transition easing ease (implicit) Replace .4s with .4s cubic-bezier(0.4,0,0.2,1) for a Material spring, or .4s ease-out for natural deceleration.
letter-spacing (start) 0 The letter-spacing: 0 line in .text-spacing — start from -.05em for a more dramatic 'tight → airy' effect.
font-size 2.5rem In .demo-text — the effect is more spectacular on larger sizes. Below 1 rem a px expansion is barely noticeable.
font-weight 800 In .demo-text — a high weight (700–900) maximizes the visual contrast between the tight and spread states.

FAQ

letter-spacing increases the rendered width of the inline element. To avoid layout shift, wrap the span in a fixed-width container, or add min-width: max-content to a nav item to reserve the maximum space on load.
Keyboard: add .text-spacing:focus { letter-spacing: 8px }. Via JS: toggle a CSS class (el.classList.toggle('expanded')) with .text-spacing.expanded { letter-spacing: 8px } — the CSS transition plays automatically in both directions.
Yes. letter-spacing is independent of a variable font's axes. You can combine the spacing expansion with a simultaneous transition on font-variation-settings (weight, width) — the browser interpolates both properties at the same time.