Line Clamp

Limiting the number of lines displayed for text content.

Usage

Use d-lc-{n} to truncate text at a specific number of lines with an ellipsis.

<p class="d-lc-{n}">Lorem ipsum dolor...</p>

Avoiding display conflicts

Flex example

<!-- This won't work because DtStack is flex-based -->
<dt-stack class="d-lc-3"> ... </dt-stack>

<!-- This will -->
<dt-stack>
  <p class="d-lc-3"> ... </p>
</dt-stack>

Grid example

<!-- This won't work -->
<div class="d-lc-3 d-d-grid"> ... </div>

<!-- This will -->
<div class="d-d-grid">
  <p class="d-lc-3"> ... </p>
</div>

Custom

The d-lc-{n} utility currently goes up to 9. Should you need to go beyond, use the d-lc-custom class and locally adjust the CSS custom property --lc-lines.

<div class="d-lc-custom" style="--lc-lines: 11">
  ...
</div>

Classes

Class
Output
.d-lc-1 -webkit-line-clamp: 1 !important;
.d-lc-2 -webkit-line-clamp: 2 !important;
.d-lc-3 -webkit-line-clamp: 3 !important;
.d-lc-4 -webkit-line-clamp: 4 !important;
.d-lc-5 -webkit-line-clamp: 5 !important;
.d-lc-6 -webkit-line-clamp: 6 !important;
.d-lc-7 -webkit-line-clamp: 7 !important;
.d-lc-8 -webkit-line-clamp: 8 !important;
.d-lc-9 -webkit-line-clamp: 9 !important;
.d-lc-none -webkit-line-clamp: unset !important;
.d-lc-unset -webkit-line-clamp: unset !important;
Line Clamp documentation last updated Thursday, June 11, 2026