Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / CSS

text-decoration — decorative text lines

The text-decoration shorthand sets the kind, style, color, and thickness of decorative text lines. Omitted components reset to their initial values.

Version: CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required

Syntax

text-decoration: <'text-decoration-line'> || <'text-decoration-thickness'> || <'text-decoration-style'> || <'text-decoration-color'>;

text-decoration sets text-decoration-line, text-decoration-thickness, text-decoration-style, and text-decoration-color together. underline adds an underline, overline a line above the text, and line-through a strike-through; these can be combined. none creates no line.

Components can appear in any order. Omitted values reset to their initial values: none, auto, solid, and currentcolor, respectively for line kind, thickness, style, and color. A color alone does not enable decoration. The shorthand does not reset text-underline-offset or text-underline-position.

The component properties are not inherited, but an ancestor’s line can cover descendant text. Therefore, text-decoration: none on a nested inline element does not remove the ancestor’s underline. The example demonstrates this distinction.

Thickness in the shorthand comes from Level 4; Level 3 covers the other three components. The Level 4 document is a draft, not a support guarantee. The example requires local verification in Chromium 152.

Examples

<!doctype html>
<meta charset="utf-8">
<title>text-decoration</title>
<style>
  .sample {
    color: black;
    font: 24px sans-serif;
    text-decoration: underline solid #0000ff 2px;
  }
  .sample span { text-decoration: none; }
</style>
<p class="sample">CSS <span>decoration</span></p>

Result

CSS decoration

The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.

Sources