如何实现这种效果呢 如图所示 首先要给内容外盒子设置宽度 然后加上这三个css属性就ok了 text-overflow: ellipsis; overflow: hidden; white-space: nowrap;