Text decoration

Source: https://getbootstrap.com/docs/6.0/utilities/text-decoration

Utilities for controlling text decoration, text transform, and text color reset.

Text decoration

Decorate text in components with text decoration classes.

<Example code={&lt;p class="text-decoration-underline">This text has a line underneath it.&lt;/p> &lt;p class="text-decoration-line-through">This text has a line going through it.&lt;/p> &lt;a href="#" class="text-decoration-none">This link has its text decoration removed&lt;/a>} />

Underline

Offset

Change the underline’s distance from your text. Offset is set in em units to automatically scale with the element’s current font-size.

<Example code={&lt;p>&lt;a href="#">Default link&lt;/a>&lt;/p> &lt;p>&lt;a class="underline-offset-1" href="#">Offset 1 link&lt;/a>&lt;/p> &lt;p>&lt;a class="underline-offset-2" href="#">Offset 2 link&lt;/a>&lt;/p> &lt;p>&lt;a class="underline-offset-3" href="#">Offset 3 link&lt;/a>&lt;/p>} />

Color

Change the underline’s color independent of the text color.

<Example code={getData('theme-colors').map((themeColor) => <p><a href="#" class="underline-${themeColor.name}">${themeColor.title} underline</a></p>)} />

Opacity

Change the underline’s opacity. Fades the current text color by default, or pair with .underline-{color} to first set a color that the opacity is then mixed against.

<Example code={&lt;p>&lt;a class="underline-10" href="#">Underline opacity 10&lt;/a>&lt;/p> &lt;p>&lt;a class="underline-20" href="#">Underline opacity 20&lt;/a>&lt;/p> &lt;p>&lt;a class="underline-30" href="#">Underline opacity 30&lt;/a>&lt;/p> &lt;p>&lt;a class="underline-40" href="#">Underline opacity 40&lt;/a>&lt;/p> &lt;p>&lt;a class="underline-50" href="#">Underline opacity 50&lt;/a>&lt;/p> &lt;p>&lt;a class="underline-60" href="#">Underline opacity 60&lt;/a>&lt;/p> &lt;p>&lt;a class="underline-70" href="#">Underline opacity 70&lt;/a>&lt;/p> &lt;p>&lt;a class="underline-80" href="#">Underline opacity 80&lt;/a>&lt;/p> &lt;p>&lt;a class="underline-90" href="#">Underline opacity 90&lt;/a>&lt;/p> &lt;p>&lt;a class="underline-100" href="#">Underline opacity 100&lt;/a>&lt;/p>} />

Pair an opacity class with a color class to fade that specific color instead of the default text color:

<Example code={<a class="theme-success underline-success underline-30 hover:underline-80" href="#">Faded success underline</a>} />

Thickness

Change the thickness of the underline.

<Example code={&lt;p>&lt;a href="#">Default link&lt;/a>&lt;/p> &lt;p>&lt;a class="underline-thickness-1" href="#">Thickness 1 link&lt;/a>&lt;/p> &lt;p>&lt;a class="underline-thickness-2" href="#">Thickness 2 link&lt;/a>&lt;/p> &lt;p>&lt;a class="underline-thickness-3" href="#">Thickness 3 link&lt;/a>&lt;/p> &lt;p>&lt;a class="underline-thickness-4" href="#">Thickness 4 link&lt;/a>&lt;/p> &lt;p>&lt;a class="underline-thickness-5" href="#">Thickness 5 link&lt;/a>&lt;/p>} />

Hover variants

The .underline-offset, .underline-{N}, and .underline-thickness utilities include :hover variants by default. Mix and match to create unique link styles.

Underline with offset and opacity changes on hover

</a>`} />

CSS

Sass utilities API

Text decoration utilities are declared in our utilities API in scss/_utilities.scss. Learn how to use the utilities API.