设置文本过长不换行,超出字符以"..."省略号显示

版权声明:虽然我很菜,但我在努力! https://blog.csdn.net/qq_39331713/article/details/85158695

设置文本过长不换行,超出字符以"..."省略号显示。 

<p style='width:380px;overflow: hidden;text-overflow:ellipsis;white-space: nowrap;'></p>

注意:一定要设置width属性,不然不会有效果。 

overflow: hidden;        /*对超出容器的部分强制截取,高度不确定则换行*/
text-overflow: ellipsis;    /*显示省略符号来代表被修剪的文本。*/
white-space: nowrap;      /*禁止换行*/

猜你喜欢

转载自blog.csdn.net/qq_39331713/article/details/85158695
今日推荐