Text UtilitiesLesson 112Free preview
Truncate Text
This lesson is part of Web Developer Tools · All levels
Summary
Truncate cuts text that is too long to a certain extent, often with an ellipse at the end. A good cut is made at the word boundary so that the sentence does not break in the middle. For web displays, CSS can also cut text without changing the original data. Always make a distinction between cutting for display and storing the full version in the data source.
Key points
- Determine the maximum length and whether the ellipse is included
- Cut the word boundary to make the result easier to read
- Add the ellipse only if the text is actually cut
- CSS text-overflow can handle visual cutting
- Carefully cut out the emoji or combined characters
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.