Testing

CSS Line Clamp: Browser Support, Usage, Known Issues

CSS line-clamp works in Chrome 14+, Edge 17+, Firefox 68+, Safari 5+, Opera 15+, and Samsung Internet 4+. Learn line-clamp browser support and quirks.

Author

Prince Dewani

May 1, 2026

CSS line-clamp is a W3C CSS Overflow Module Level 4 property that limits text to a chosen number of lines, with an ellipsis at the cut-off. The -webkit-line-clamp form works in Chrome 14+, Edge 17+, Firefox 68+, Safari 5+, Opera 15+, and Samsung Internet 4+, while Internet Explorer 5.5 to 11 never added support.

This guide covers what CSS line-clamp is, the browsers that support it, how to use it, the difference between line-clamp and -webkit-line-clamp, and the known issues.

What is CSS line-clamp?

CSS line-clamp is a W3C property in the CSS Overflow Module Level 4 specification that limits a block container to a chosen number of visible lines. The browser truncates the overflowing content and adds an ellipsis at the cut-off. Most production sites also use the older -webkit-line-clamp form for wider engine support.

Which browsers does CSS line-clamp support?

The -webkit-line-clamp form works in every modern desktop and mobile browser. Chrome 14+, Edge 17+ on Windows, Firefox 68+, Safari 5+ on macOS and iOS, Opera 15+, and Samsung Internet 4+ all enable it by default, while Internet Explorer 5.5 through 11 never received support.

Loading browser compatibility data...

CSS line-clamp compatibility in Chrome

Chrome supports -webkit-line-clamp by default from Chrome 14 on Windows, macOS, Linux, ChromeOS, and Android. The unprefixed line-clamp property also resolves on current Chrome through the same Blink rendering path, so a single rule with both forms covers every release from Chrome 14 forward.

CSS line-clamp compatibility in Edge

Microsoft Edge supports -webkit-line-clamp by default from Edge 17 in legacy EdgeHTML builds and from Edge 79 in the Chromium-based releases that ship today. Edge 12 to 16 did not support it. Users on Windows 11 inherit the same -webkit-line-clamp behavior as Chrome because Edge runs on Blink.

CSS line-clamp compatibility in Firefox

Firefox supports -webkit-line-clamp by default from Firefox 68 on Windows, macOS, Linux, and Android. Mozilla added the WebKit-prefixed alias to fix layout breakage on sites that ship a single -webkit- prefixed clamp rule. Firefox 2 to 67 did not support line-clamp at all.

CSS line-clamp compatibility in Safari

Safari supports -webkit-line-clamp by default from Safari 5 on macOS and from iOS 5 on iPhone and iPad. WebKit shipped the original implementation, so every modern Apple device renders the property correctly. Safari 3.1 to 4 on macOS and Safari on iOS 3.2 to 4.3 do not support it.

CSS line-clamp compatibility in Opera

Opera supports -webkit-line-clamp by default from Opera 15 on desktop and from Opera Mobile 14 on Android. Opera 9 to 12.1 ran on the Presto engine and did not parse -webkit-line-clamp, but those builds offered a similar single-line truncation through the proprietary -o-ellipsis-lastline value for text-overflow.

CSS line-clamp compatibility in Samsung Internet

Samsung Internet supports -webkit-line-clamp by default from version 4 on Galaxy phones and tablets. Every Samsung Internet release since then renders the property exactly like Chrome on Android because the browser shares the underlying Chromium engine.

CSS line-clamp compatibility in Android Browser

The legacy Android Browser supported -webkit-line-clamp on Android 2.3 through 4.4.4. Modern Android Browser builds on Chromium 147 and later inherit the property from the system WebView. Apps that embed WebView on Android 5.0 and later pick up -webkit-line-clamp once the WebView updates past the same Chromium baseline.

CSS line-clamp compatibility in Internet Explorer

Internet Explorer 5.5 through 11 do not support -webkit-line-clamp or the unprefixed line-clamp in any version. The Trident engine never received the property. Users on Windows who need line-clamp should switch to Microsoft Edge 79 or later, or to Chrome 14 or later.

Note

Note: CSS line-clamp breaks across browsers when shipped without the -webkit- prefix. Test it on real browsers and OS with TestMu AI. Try TestMu AI free!

How do you use CSS line-clamp?

CSS line-clamp needs four declarations working together to clamp text to a fixed number of lines. The pattern below works in every browser that supports -webkit-line-clamp, including Chrome 14+, Firefox 68+, and Safari 5+.

  • Set display to a WebKit box: Apply display: -webkit-box (or -webkit-inline-box) on the container so the box renders as a vertical WebKit box.
  • Set the box orientation: Add -webkit-box-orient: vertical so the children stack top to bottom inside that box.
  • Choose the line count: Add -webkit-line-clamp with the integer number of visible lines you want before truncation, for example -webkit-line-clamp: 3 for a three-line teaser.
  • Hide the overflow: Add overflow: hidden so the text past the limit disappears instead of leaking outside the container.
  • Add the unprefixed property as future-proofing: Append line-clamp with the same number to opt into the unprefixed CSS Overflow Module Level 4 property in browsers that already parse it.
/* Three-line teaser that clamps in every -webkit-line-clamp browser. */
.teaser {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    overflow: hidden;
}

Drop the four -webkit- declarations and the unprefixed line-clamp on the same selector, and any modern browser will clamp the text exactly as written.

What is the difference between line-clamp and -webkit-line-clamp?

The two properties exist for the same outcome but live in different specs and ship with different requirements. The table below contrasts them on the dimensions QA engineers and developers care about.

Dimensionline-clamp-webkit-line-clamp
Spec bodyW3C CSS Overflow Module Level 4Apple proprietary, later aliased by W3C
Spec statusWorking DraftDe facto standard across engines
Default browser supportLimited, still rolling out across enginesChrome 14+, Edge 17+ and 79+, Firefox 68+, Safari 5+, Opera 15+, Samsung Internet 4+
Required companion propertiesNone, works on its own once supporteddisplay: -webkit-box, -webkit-box-orient: vertical, overflow: hidden
Production usageFuture-proofing alongside the prefixStandard cross-browser pattern today
Internet Explorer supportNot supportedNot supported
...

What are the known issues with CSS line-clamp?

CSS line-clamp ships in every modern engine, but the way browsers parse and resolve it still has rough edges that hit production sites. Plan around these before you replace JavaScript-driven truncation with line-clamp.

  • Spec still in Working Draft: The unprefixed line-clamp property lives in CSS Overflow Module Level 4, which the W3C lists as a Working Draft. Until the spec stabilizes, the prefixed -webkit-line-clamp remains the only form every engine resolves consistently.
  • Companion properties are not optional: -webkit-line-clamp only clamps when the container also sets display: -webkit-box, -webkit-box-orient: vertical, and overflow: hidden. Drop any one of those and the property silently falls back to no clamping.
  • Block containers only: -webkit-line-clamp ignores inline elements. Wrap the text in a block container before applying the property, otherwise the ellipsis never appears.
  • No control over the ellipsis character: Browsers render the truncation as a Unicode ellipsis and offer no hook to swap it out. Custom truncation indicators require JavaScript or a separate text-overflow workaround.
  • Line-height rounding differs across engines: If the clamped text contains inline images, padding, or trailing whitespace, engines round the line height differently and may show a fourth partial line on Firefox where Chrome shows only three.

In my experience, the silent failure that bites teams the most is forgetting display: -webkit-box: a -webkit-line-clamp: 3 rule on a plain block does nothing in Chrome or Safari, and the bug only shows up at QA on multiple devices.

...

Citations

All CSS line-clamp version numbers and platform notes in this guide come from these primary sources:

Author

Prince Dewani is a Community Contributor at TestMu AI, where he manages content strategies around software testing, QA, and test automation. He is certified in Selenium, Cypress, Playwright, Appium, Automation Testing, and KaneAI. Prince has also presented academic research at the international conference PBCON-01. He further specializes in on-page SEO, bridging marketing with core testing technologies. On LinkedIn, he is followed by 4,300+ QA engineers, developers, DevOps experts, tech leaders, and AI-focused practitioners in the global testing community.

Open in ChatGPT Icon

Open in ChatGPT

Open in Claude Icon

Open in Claude

Open in Perplexity Icon

Open in Perplexity

Open in Grok Icon

Open in Grok

Open in Gemini AI Icon

Open in Gemini AI

Copied to Clipboard!
...

3000+ Browsers. One Platform.

See exactly how your site performs everywhere.

Try it free
...

Write Tests in Plain English with KaneAI

Create, debug, and evolve tests using natural language.

Try for free

Frequently asked questions

Did you find this page helpful?

More Related Hubs

TestMu AI forEnterprise

Get access to solutions built on Enterprise
grade security, privacy, & compliance

  • Advanced access controls
  • Advanced data retention rules
  • Advanced Local Testing
  • Premium Support options
  • Early access to beta features
  • Private Slack Channel
  • Unlimited Manual Accessibility DevTools Tests