25 CSS Hacks Every Developer Should Know

Text truncation with ellipsis

Problem: truncating overflowing text.

Solution: use `text-overflow`.

.truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 200px; /* or any width */
}