Zest.

CSS: Truncate text with an ellipsis

A short, tested CSS example for truncate text with an ellipsis. Copy it and adjust the names and paths for your project.

CSS
/* one line */
.title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* several lines */
.text {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

Find it in Zest

Search for “css truncate text with an ellipsis” in Zest and this example appears above the results, with other matches to choose from. Searches stay private.

More CSS examples

All CSS examples