Browse documentation

Reference / Typography

Underline thickness and offset

Set how thick an underline is and how far it sits below the baseline.

Working example

An em-based offset grows with the type. A numeric offset such as underline-offset-4 sets a length in pixels.

HTML
<p class="font-serif text-2xl underline decoration-2 underline-offset-4">
  First impressions
</p>

Class reference

ClassCSS declarations
decoration-autotext-decoration-thickness: auto;
decoration-from-fonttext-decoration-thickness: from-font;
decoration-2text-decoration-thickness: 2px;
decoration-[.12em]text-decoration-thickness: .12em;
underline-offset-2text-underline-offset: 2px;
underline-offset-4text-underline-offset: 4px;
underline-offset-[.2em]text-underline-offset: .2em;
View full generated CSS
Compiled CSS
.decoration-2 {
  text-decoration-thickness: 2px;
}
.decoration-\[\.12em\] {
  text-decoration-thickness: .12em;
}
.decoration-auto {
  text-decoration-thickness: auto;
}
.decoration-from-font {
  text-decoration-thickness: from-font;
}
.underline-offset-2 {
  text-underline-offset: 2px;
}
.underline-offset-4 {
  text-underline-offset: 4px;
}
.underline-offset-\[\.2em\] {
  text-underline-offset: .2em;
}