Limit text length to n lines using CSS
There is a way, but it is webkit-only. However, when you combine this with line-height: X;, and max-height: X*N;, it will also work in other browsers, just without ellipses.
.giveMeEllipsis { overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: N; /* number of lines to show */ line-height: X; /* fallback */ max-height: X*N; /* fallback */ }
Share