Tailwind Text Decoration Generator

Create beautiful text decorations with Tailwind CSS classes

Decoration Options

Live Preview

Tailwind Text Decoration

Generated Tailwind Classes


                

Using Tailwind Text Decoration in Projects

What This Tool Creates

This generator produces utility classes that map to CSS text-decoration properties. Unlike traditional CSS, Tailwind separates decoration properties into individual, composable classes:

  • underline, overline, line-through for decoration type
  • decoration-{style} for line style (solid, dashed, wavy, etc.)
  • decoration-{color} for line color independent of text color
  • decoration-{width} for line thickness (1px, 2px, 4px, 8px)
  • underline-offset-{size} for spacing control

This modular approach lets you mix and match properties without writing custom CSS.

Practical Applications

Interactive Links & Buttons

Use hover states with underline-offset-2 and hover:decoration-{color} for accessible interactive elements. For more hover effects, check out the hover effect generator.

<a class="underline decoration-blue-500 hover:decoration-blue-700 underline-offset-2">

Content Highlighting

Combine line-through with muted colors for sale prices, or overline for editorial annotations. Pair with gradient text effects for enhanced visual hierarchy.

<span class="line-through decoration-red-500 text-gray-500">$99</span>

Form Field Validation

Use focus states with focus:underline and focus:decoration-{color} to indicate active inputs. The input field styler offers additional form styling options.

<input class="focus:underline focus:decoration-blue-500" />

Typography Hierarchy

Subtle underlines with decoration-1 and offset for section headers without overpowering content. The font generator helps complete your typography system.

<h2 class="underline decoration-gray-300 underline-offset-4">

How Tailwind Builds These Classes

Tailwind's text decoration utilities are generated from these CSS properties:

/* Generated CSS from Tailwind classes */
.underline { text-decoration-line: underline; }
.decoration-dashed { text-decoration-style: dashed; }
.decoration-blue-500 { text-decoration-color: #3b82f6; }
.decoration-2 { text-decoration-thickness: 2px; }
.underline-offset-2 { text-underline-offset: 2px; }

When you combine multiple classes, Tailwind applies them in order, with later classes potentially overriding earlier ones based on CSS specificity rules.

Responsive & State Variants

Tailwind's variant system allows decoration changes across breakpoints and states, similar to how you'd use the flexbox builder for layout variants:

  • Responsive: md:underline applies underline only on medium screens and up
  • Hover/Focus: hover:decoration-wavy changes style on interaction
  • Dark mode: dark:decoration-gray-400 adapts to user preferences
  • Motion: motion-safe:decoration-2 for reduced motion considerations

Note: The generator focuses on hover, focus, and dark variants. You can manually add responsive prefixes like md: or lg: to generated classes.

Accessibility Considerations

Sufficient Color Contrast

Ensure decoration colors have at least 3:1 contrast against the background, especially for underlines which are typically thinner. Tools like the shadow generator can help with visual depth.

Focus Indicators

When using focus:underline for interactive elements, ensure it's not the sole focus indicator. Combine with outline or background changes. The border animation generator offers animated focus states.

Motion Sensitivity

Wavy decorations and transitions may affect users with vestibular disorders. Consider using motion-reduce:decoration-solid for accessibility. The parallax effect maker includes motion preferences.

Customizing Beyond the Generator

Extend the generated output with your Tailwind configuration:

Add Custom Colors

// tailwind.config.js
module.exports = {
  theme: {
    extend: {
      textDecorationColor: {
        'brand': '#ff6b35',
        'accent': '#00a8e8'
      }
    }
  }
}

Use: decoration-brand or decoration-accent

Custom Thickness Values

// tailwind.config.js
module.exports = {
  theme: {
    extend: {
      textDecorationThickness: {
        '3': '3px',
        '10': '10px',
        'custom': '0.5rem'
      }
    }
  }
}

Use: decoration-3 or decoration-custom

Implementation Guide

Copy & Paste Usage

  1. Configure your decoration using the controls above
  2. Click "Copy" to copy the generated classes
  3. Apply directly to any HTML element: <p class="underline decoration-dashed decoration-blue-500">
  4. For dynamic states, ensure JavaScript adds/removes classes appropriately

Framework-Specific Notes

  • React/Vue: Classes work directly with className or :class bindings
  • Next.js: Ensure Tailwind is properly configured in postcss.config.js
  • Svelte: Use class:underline={condition} for conditional decoration
  • Alpine.js: Bind with :class="{'underline': isUnderlined}"

Frequently Asked Questions

Why doesn't underline-offset work with overline or line-through?

CSS text-underline-offset only affects underlines. For other decoration types, spacing is controlled by line-height and padding.

Can I use multiple decoration types at once?

CSS doesn't support multiple text-decoration-line values per element in Tailwind's implementation. Use nested spans for combined effects.

Do these work with text-shadow or background-clip:text?

Yes, text decorations work independently of other text effects. Gradient text with decoration is fully supported. Try the gradient text tool for examples.

Browser support for wavy decorations?

Wavy decorations (decoration-wavy) are supported in Chrome 89+, Firefox 70+, Safari 12.1+. Solid fallback is recommended.

Tool Limitations & Assumptions

  • Generates utility classes only - no custom CSS or component code
  • Color palette limited to Tailwind's default colors
  • Does not generate responsive prefixes automatically (add manually)
  • Animation uses generic transition-all - customize for performance
  • Assumes Tailwind v3.0+ for all features

Explore Related Tailwind Tools

Text Effects

Create eye-catching typography with gradient text and custom fonts.

Interactive Elements

Style hover effects and animated borders for better UX.

Layout & Spacing

Control letter spacing and line height for perfect typography.

Trust & Privacy

  • No tracking, analytics, or data collection
  • 100% client-side execution - no code sent to servers
  • Open source dependencies (Tailwind CSS, Tippy.js)

Technical Details

  • Tailwind Version: Compatible with v3.0+
  • Browser Support: Chrome 90+, Firefox 88+, Safari 14+, Edge 90+
  • Performance: No build step required - use classes directly
  • File Size: Generated classes purge unused styles in production
  • Last Reviewed: Jan 2026 for Tailwind v3.3 compatibility