property

webkit line clamp — CSS reference

Legacy multiline truncation requires display:-webkit-box (or -webkit-inline-box) and -webkit-box-orient:vertical. Overflow hidden clips remaining content. Preserve important text elsewhere or offer an expansion control; clipping does not remove the underlying DOM text.

Formal Syntax & Structure

css syntaxcss
-webkit-line-clamp: 2;

Working Example

Example Snippetcss
<!doctype html><html lang="en"><meta charset="utf-8"><title>-webkit-line-clamp</title><style>body{margin:8px;background:white;color:black;font:16px/20px sans-serif}*{box-sizing:content-box}#a{width:100px;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden;line-height:20px}</style><body><p id="a">One<br>Two<br>Three<br>Four</p></body></html>
CSS Reference