Browse documentation
Reference / Typography
Underline thickness and offset
Set how thick an underline is and how far it sits below the baseline.
Working example
First impressions
An em-based offset grows with the type. A numeric offset such as underline-offset-4 sets a length in pixels.
<p class="font-serif text-2xl underline decoration-2 underline-offset-4">
First impressions
</p>Class reference
| Class | CSS declarations |
|---|---|
decoration-auto | text-decoration-thickness: auto; |
decoration-from-font | text-decoration-thickness: from-font; |
decoration-2 | text-decoration-thickness: 2px; |
decoration-[.12em] | text-decoration-thickness: .12em; |
underline-offset-2 | text-underline-offset: 2px; |
underline-offset-4 | text-underline-offset: 4px; |
underline-offset-[.2em] | text-underline-offset: .2em; |
View full generated 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;
}