zjffun blog

Text wrap and overflow

更新于 写于 CSS

Wrap

Overflow

Examples

One line:

css
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;

Multiple lines:

css
display: -webkit-box;
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;
overflow: hidden;

Tips

If you both set white-space: no-wrap; and word-break: break-all;, the text will not be wrapped.