line-clamp

Limited availability

The line-clamp CSS property limits the text in a block container to a certain number of lines. The prefixed -webkit-line-clamp is widely supported but only works with -webkit-box-orient: vertical in combination with display: -webkit-box or display: -webkit-inline-box.

Browser support (view on caniuse.com)

  • Chrome Not supported Bugs: 40336192
  • Chrome Android Not supported
  • Edge Not supported
  • Firefox Not supported Bugs: 1540681
  • Firefox for Android Not supported
  • Safari Not supported
  • Safari on iOS Not supported

Need this feature?
Leave a 👍 on the feedback issue
Don't forget to also leave a comment explaining your specific use case.

MDN documentation

Developer use cases

  • Clamp user-entered text, in my case a page title, to a set number of lines with an ellipsis. The length can't be predicted or trimmed on the server, and the limit differs by viewport (two lines on desktop, three on phones). Clamp user-entered text, in my case a page title, to a set number of lines with an ellipsis. The length can't be predicted or trimmed on the server, and the limit differs by viewport (two lines on desktop, three on phones). [see original comment]