CSS Portal

CSS text-decoration-line Property

If this site has been useful, we’d love your support! Consider buying us a coffee to keep things going strong!

Description

The text-decoration-line CSS property specifies which decoration lines are to be drawn on an element’s text. It is the declarative control that tells the rendering engine to paint one or more lines associated with the text box rather than changing the box’s layout or the glyph shapes themselves. Because the effect is a painting instruction, it typically does not directly alter text metrics or line-height; instead it is layered on top of (or sometimes beneath) the glyphs during the painting phase of rendering.

In practical use, text-decoration-line is most often combined with complementary properties that control the decoration’s appearance and placement. For example, you would commonly use it together with the shorthand text-decoration as well as the appearance-related properties text-decoration-color, text-decoration-style, and text-decoration-thickness to tune color, stroke style, and thickness. These properties separate the semantic decision of “which lines” from the visual details of “how those lines look,” which makes styling more modular and easier to maintain.

Because decorations are painted and not inherited in the same way as many typographic properties, they interact with nested content in a nuanced way: a decoration applied to a container can visually extend across its inline-level descendants unless those descendants override the decoration properties. Engines also implement heuristics to avoid ugly collisions with glyphs (for example via the behavior controlled by text-decoration-skip-ink) and to allow explicit adjustments of vertical placement (for finer control one can use text-underline-offset). That means when you design typographic effects with text-decoration-line, you should consider both the decoration’s semantic role and how it will visually interact with nearby text and inline elements.

Finally, text-decoration-line supports composing multiple decoration lines simultaneously, and these can be animated or transitioned as part of visual effects (subject to what the user agent supports for painting and compositing). Because decorations are part of the painting layer, animating their color, thickness, or vertical offset is often visually cheaper than reflowing text. However, be mindful of accessibility and semantic meaning: decorations are commonly used to indicate links and deletions, so changing them purely for decorative purposes should still preserve the clarity and affordances users expect.

Definition

Initial value
none
Applies to
All elements
Inherited
No
Computed value
As specified
Animatable
No
JavaScript syntax
object.style.textDecorationLine

Interactive Demo

The rusty swing set creaked.

Syntax

text-decoration-line: none | [ underline || overline || line-through ]

Values

  • noneProduces no text decoration.
  • underlineEach line of text is underlined.
  • overlineEach line of text has a line over it.
  • line-throughEach line of text has a line through the middle.

Example

<div class="example">
<h2>text-decoration-line examples</h2>
<p class="none">No decoration: This text has text-decoration-line: none;</p>
<p class="underline">Underline: This text has text-decoration-line: underline;</p>
<p class="overline">Overline: This text has text-decoration-line: overline;</p>
<p class="line-through">Line-through: This text has text-decoration-line: line-through;</p>
<p class="underline-overline">Underline + Overline: This text has text-decoration-line: underline overline;</p>
</div>
/* Base page styles */
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
  background: #f7f8fa;
  color: #1f2937;
  padding: 24px;
}

.example {
  max-width: 720px;
  margin: 0 auto;
}

p {
  padding: 10px 14px;
  margin: 12px 0;
  background: #ffffff;
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(16,24,40,0.04);
  font-size: 16px;
}

/* text-decoration-line examples */
.none {
  text-decoration-line: none;
}

.underline {
  text-decoration-line: underline;
  text-decoration-color: #1e88e5;
  text-decoration-thickness: 2px;
}

.overline {
  text-decoration-line: overline;
  text-decoration-color: #e91e63;
}

.line-through {
  text-decoration-line: line-through;
  text-decoration-color: #fb8c00;
}

.underline-overline {
  text-decoration-line: underline overline;
  text-decoration-color: #43a047;
  text-decoration-thickness: 2px;
}

Browser Support

The following information will show you the current browser support for the CSS text-decoration-line property. Hover over a browser icon to see the version that first introduced support for this CSS property.

This property is supported by all modern browsers.
Desktop
Chrome
Edge
Firefox
Opera
Safari
Tablets & Mobile
Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-

Last updated by CSSPortal on: 1st January 2026

If this site has been useful, we’d love your support! Consider buying us a coffee to keep things going strong!