电脑端
设置行高, 超出隐藏
- p{
- width: 80%;
- height: 16px;
- line-height: 16px;
- display: block;
- overflow: hidden;
- text-overflow: ellipsis;
- -ms-text-overflow: ellipsis;
- white-space:nowrap;
- }
移动端
- p {
- overflow: hidden;
- text-overflow: ellipsis;
- -ms-text-overflow: ellipsis;
- display: box;
- display: -webkit-box;
- line-clamp: 1;
- -webkit-line-clamp: 1;
- -webkit-box-orient: vertical;
- }
来源: http://www.bubuko.com/infodetail-2694146.html