Firefox,Chrome,Safari,Opera等浏览器较新版本均支持:text-overflow:ellipsis;了。 <!DOCTYPE html> <html> <head> <meta charset="gbk"> <title>text-overflow: ellipsis;</title> </head> <style> .text-overflow { display: inline-block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } </style> <body> <a href="#" class="text-overflow" style="width:110px;">测试文字能否被截取</a><br> <b class="text-overflow" style="width:100px;">测试文字能否被截取</b> </body> </html> |
|