files/en-us/web/css/reference/properties/line-clamp/index.md
The line-clamp CSS property allows limiting of the contents of a {{Glossary("block")}} to the specified number of lines.
[!NOTE] For legacy support, the vendor-prefixed
-webkit-line-clampproperty only works in combination with the {{cssxref("display")}} property set to-webkit-boxor-webkit-inline-boxand the {{cssxref("box-orient", "-webkit-box-orient")}} property set tovertical. Despite these prefixed properties being deprecated, the co-dependency of these three properties is a fully specified behavior and will continue to be supported.
In most cases you will also want to set {{cssxref("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.
/* Keyword value */
line-clamp: none;
/* <integer> values */
line-clamp: 3;
line-clamp: 10;
/* Global values */
line-clamp: inherit;
line-clamp: initial;
line-clamp: revert;
line-clamp: revert-layer;
line-clamp: unset;
none
{{CSSInfo}}
{{CSSSyntax}}
<p>
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>
p {
width: 300px;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 3;
overflow: hidden;
}
{{EmbedLiveSample("Truncating_a_paragraph", "100%", "130")}}
{{Specifications}}
{{Compat}}