<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> </head> <body> <div style="width: 120px; height: 50px; border: 1px solid blue; overflow: hidden; text-overflow:ellipsis"> <nobr>就是比如有一行文字,很长,表格内一行显示不下.</nobr> </div> </body> </html>
第二种:
p{ width: 2rem; height: 0.95rem; line-height: 0.3rem; padding: 0 0.2rem 0 0.08rem; font-size: 0.22rem; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }