How to set a maximum number of lines of text with CSS

Kevin Powell on YouTubeWatch on YouTube

SaveMark complete

Sign in to save videos and track what you’ve finished.

IntermediateWeb DesignUI4 min

About this video

A short CSS tutorial showing a simple, CSS-only way to limit the number of visible lines of text within an element. It suits front-end and web designers who already work with CSS.

What you’ll learn

  • Limit an element's text to a set number of visible lines using CSS
  • Recognise the trade-offs of a CSS-only truncation approach