Skip to content

Latest commit

 

History

History
28 lines (20 loc) · 754 Bytes

File metadata and controls

28 lines (20 loc) · 754 Bytes

Limit characters to multiple lines

Use line-clamp to limit the numbers of lines a text can take. The value defines the maximum number of lines that the text can take up.

p {
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2; 
  -webkit-box-orient: vertical;
}

Notes

  • text-overflow: ellipsis is optional, it just shows three dots after the cut-off text
  • display: -webkit-box and -webkit-box-orient: vertical are mandatory for WebKit browsers

Refs