{"id":8542,"date":"2011-02-18T06:03:21","date_gmt":"2011-02-18T13:03:21","guid":{"rendered":"http:\/\/css-tricks.com\/"},"modified":"2022-09-30T10:58:16","modified_gmt":"2022-09-30T17:58:16","slug":"truncate-string-with-ellipsis","status":"publish","type":"page","link":"https:\/\/css-tricks.com\/snippets\/css\/truncate-string-with-ellipsis\/","title":{"rendered":"Truncate String with Ellipsis"},"content":{"rendered":"\n

All the following are required, so the text must be in a single straight line that overflows a box where that overflow is hidden.<\/p>\n\n\n\n

.truncate {\n  width: 250px;\n  white-space: nowrap;\n  overflow: hidden;\n  text-overflow: ellipsis;\n}<\/code><\/pre>\n\n\n\n