Browse documentation
Reference / Typography
Line clamp
Limit a multiline excerpt to a fixed number of visible lines.
Working example
The old paper mill stands at the edge of the river. Its windows still catch the first light over the valley.
Use this for summaries with a route to the full text. Line breaks depend on the available width and font metrics.
<p class="line-clamp-2 max-w-[24ch] leading-relaxed">
The old paper mill stands at the edge of the river. Its windows still catch the first light over the valley.
</p>Class reference
| Class | CSS declarations |
|---|---|
line-clamp-1 | overflow: hidden;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 1; |
line-clamp-2 | overflow: hidden;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2; |
line-clamp-3 | overflow: hidden;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 3; |
line-clamp-none | overflow: visible;
display: block;
-webkit-box-orient: horizontal;
-webkit-line-clamp: unset; |
View full generated CSS
.line-clamp-1 {
overflow: hidden;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 1;
}
.line-clamp-2 {
overflow: hidden;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
}
.line-clamp-3 {
overflow: hidden;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 3;
}
.line-clamp-none {
overflow: visible;
display: block;
-webkit-box-orient: horizontal;
-webkit-line-clamp: unset;
}