seniorCSS

How do you achieve multi-line truncation (line-clamp) in CSS?

Updated Apr 28, 2026

Short answer

Multi-line truncation requires a combination of outdated WebKit flexbox properties that have been globally adopted as a standard hack.

Deep explanation

Unlike single-line truncation (text-overflow: ellipsis), truncating text after exactly 'X' lines requires display: -webkit-box, -webkit-line-clamp, and -webkit-box-orient: vertical. A newer, cleaner standard (line-clamp) is in the spec but lacks full support.

Unlock with a Pro subscription to view this section.

View pricing

Real-world example

No real-world example available yet.

Unlock with a Pro subscription to view this section.

Upgrade to Pro

Common mistakes

No common mistakes listed yet.

Unlock with a Pro subscription to view this section.

Upgrade to Pro

Follow-up questions

No follow-up questions available yet.

Unlock with a Pro subscription to view this section.

Upgrade to Pro

More CSS interview questions

View all →