docs.rodeo

MDN Web Docs mirror

text-decoration-thickness

{{CSSRef}} 

The text-decoration-thickness CSS property sets the stroke thickness of the decoration line that is used on text in an element, such as a line-through, underline, or overline.

{{EmbedInteractiveExample("pages/css/text-decoration-thickness.html")}} 

Syntax

/* Single keyword */
text-decoration-thickness: auto;
text-decoration-thickness: from-font;

/* length */
text-decoration-thickness: 0.1em;
text-decoration-thickness: 3px;

/* percentage */
text-decoration-thickness: 10%;

/* Global values */
text-decoration-thickness: inherit;
text-decoration-thickness: initial;
text-decoration-thickness: revert;
text-decoration-thickness: revert-layer;
text-decoration-thickness: unset;

Values

Formal definition

{{CSSInfo}} 

Formal syntax

{{csssyntax}} 

Examples

Varying thickness

HTML

<p class="thin">Here's some text with a 1px red underline.</p>
<p class="thick">This one has a 5px red underline.</p>
<p class="shorthand">This uses the equivalent shorthand.</p>

CSS

.thin {
  text-decoration-line: underline;
  text-decoration-style: solid;
  text-decoration-color: red;
  text-decoration-thickness: 1px;
}

.thick {
  text-decoration-line: underline;
  text-decoration-style: solid;
  text-decoration-color: red;
  text-decoration-thickness: 5px;
}

.shorthand {
  text-decoration: underline solid red 5px;
}

Results

{{EmbedLiveSample('Varying_thickness')}} 

Specifications

{{Specifications}} 

[!NOTE] The property used to be called text-decoration-width, but was updated in 2019 to text-decoration-thickness.

Browser compatibility

{{Compat}} 

See also

In this article

View on MDN