The -webkit-line-clamp CSS property allows limiting of the contents of a block container to the specified number of lines.

It only works in combination with the display property set to -webkit-box or -webkit-inline-box and the -webkit-box-orient property set to vertical.

In most cases you will also want to set overflow to hidden, otherwise the contents won't be clipped but an ellipsis will still be shown after the specified number of lines.

When applied to anchor elements, the truncating can happen in the middle of the text, not necessarily at the end.

Note: This property was originally implemented in WebKit and has some issues. It got standardized for legacy support. The CSS Overflow Module Level 3 specification also defines a line-clamp property, which is meant to replace this property and avoid its issues.


/* Keyword value */
-webkit-line-clamp: none;

/* <integer> values */
-webkit-line-clamp: 3;
-webkit-line-clamp: 10;

/* Global values */
-webkit-line-clamp: inherit;
-webkit-line-clamp: initial;
-webkit-line-clamp: unset;
This value specifies that the content wonʼt be clamped.
This value specifies the number of lines after which the content will be clamped. It must be greater than 0.

Formal definition

Initial value none
Applies to all elements
Inherited no
Computed value as specified
Animation type by computed value type

Formal syntax

none | <integer>


Truncating a paragraph


  In this example the <code>-webkit-line-clamp</code> property is set to <code>3</code>, which means the text is clamped after three lines.
  An ellipsis will be shown at the point where the text is clamped.


p {
  width: 300px;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;



Specification Status Comment
CSS Overflow Module Level 3
The definition of '-webkit-line-clamp' in that specification.
Working Draft Initial definition

Browser compatibilityUpdate compatibility data on GitHub

Chrome Edge Firefox Internet Explorer Opera Safari
-webkit-line-clamp 6 17 68 No 15 5
Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
-webkit-line-clamp ≤37 18 68 14 4.2 1.0

See also

© 2005–2020 Mozilla and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.