This is an important message requiring you to make a choice if you're based in the EU.

CSS line-clamp Property

The line-clamp property truncates text at a specific number of lines. It is a shorthand for:

This property is in progress.

Initial Value none
Applies to -
Inherited Yes.
Animatable No.
Version CSS3
DOM Syntax object.style.lineClamp = "2";


line-clamp: normal | <integer> | initial | inherit;


<!DOCTYPE html>
    <title>Title of the document</title>
      body {
      align-items: center;
      farthest-side at bottom left,
      farthest-corner at bottom right,
      #ccc 400px
      display: flex;
      height: 100vh;
      justify-content: center;
      line-height: 1.5;
      .element {
      background-color: #fff;
      box-shadow: 1px 1px 10px #666;
      padding: 2em;
      width: 200px;
      .element p {
      display: -webkit-box;
      -webkit-line-clamp: 3;
      -webkit-box-orient: vertical;  
      overflow: hidden;
    <h2>CSS line-clamp  property example</h2>
    <div class="element">
      <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s.

In the given example, the text is cut at the fourth line.


Value Description
none No maximum number of lines and no truncation.
<integer> Sets maximum number of lines before truncating the content and then displays an ellipsis.
initial Makes the property use its default value.
inherit Inherits the property from its parents element.

Do you find this helpful?

Related articles