使用时必须满足以下条件:
- 必须不换行,保持一行
- 使用 overflow 控制溢出
- 比如:
p {
width: 160px;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
效果如下: