{"id":230,"date":"2009-09-05T18:08:14","date_gmt":"2009-09-05T10:08:14","guid":{"rendered":"http:\/\/www.zhangxinxu.com\/wordpress\/?p=230"},"modified":"2017-12-31T01:26:58","modified_gmt":"2017-12-30T17:26:58","slug":"%e5%85%b3%e4%ba%8e%e6%96%87%e5%ad%97%e5%86%85%e5%ae%b9%e6%ba%a2%e5%87%ba%e7%94%a8%e7%82%b9%e7%82%b9%e7%82%b9-%e7%9c%81%e7%95%a5%e5%8f%b7%e8%a1%a8%e7%a4%ba","status":"publish","type":"post","link":"https:\/\/www.zhangxinxu.com\/wordpress\/2009\/09\/%e5%85%b3%e4%ba%8e%e6%96%87%e5%ad%97%e5%86%85%e5%ae%b9%e6%ba%a2%e5%87%ba%e7%94%a8%e7%82%b9%e7%82%b9%e7%82%b9-%e7%9c%81%e7%95%a5%e5%8f%b7%e8%a1%a8%e7%a4%ba\/","title":{"rendered":"\u5173\u4e8e\u6587\u5b57\u5185\u5bb9\u6ea2\u51fa\u7528\u70b9\u70b9\u70b9(&#8230;)\u7701\u7565\u53f7\u8868\u793a"},"content":{"rendered":"<p>by <a href=\"http:\/\/www.zhangxinxu.com\/\">zhangxinxu<\/a> from <a href=\"http:\/\/www.zhangxinxu.com\/\">http:\/\/www.zhangxinxu.com<\/a><br \/>\n\u672c\u6587\u5730\u5740\uff1a<a href=\"http:\/\/www.zhangxinxu.com\/wordpress\/?p=230\">http:\/\/www.zhangxinxu.com\/wordpress\/?p=230<\/a><\/p>\n<p><span style=\"color:#cd0000;\">\/\/ \u5173\u4e8e\u591a\u884c\u6587\u5b57\u70b9\u70b9\u70b9&#8230;\u663e\u793a\u89c1\u6587\u672b<\/span><\/p>\n<h3>\u6587\u5b57\u6253\u70b9\u524d\u8a00<\/h3>\n<p>\u5728\u5b9e\u9645\u7684\u9879\u76ee\u4e2d\uff0c\u7531\u4e8e\u6587\u5b57\u5185\u5bb9\u7684\u957f\u5ea6\u4e0d\u786e\u5b9a\u6027\u548c\u9875\u9762\u5e03\u5c40\u7684\u56fa\u5b9a\u6027\uff0c\u96be\u514d\u4f1a\u51fa\u73b0\u6587\u5b57\u5185\u5bb9\u8d85\u8fc7div\uff08\u6216\u5176\u4ed6\u6807\u7b7e\uff0c\u4e0b\u540c\uff09\u533a\u57df\u7684\u60c5\u51b5\uff0c\u6b64\u65f6\u6bd4\u8f83\u597d\u7684\u505a\u6cd5\u5c31\u662f\u5f53\u6587\u5b57\u8d85\u8fc7\u9650\u5b9a\u7684div\u5bbd\u5ea6\u540e\u81ea\u52a8\u4ee5\u7701\u7565\u53f7\uff08&#8230;\uff09\u663e\u793a\uff0c\u8fd9\u6837\uff0c\u6309\u7167\u4e60\u60ef\uff0c\u4eba\u4eec\u90fd\u4f1a\u77e5\u9053\u8fd9\u513f\u6709\u6587\u5b57\u88ab\u7701\u7565\u4e86\u3002css\u4e2d\u6709\u4e2a\u5c5e\u6027\u53eb\u505atext-overflow:ellipsis;\u914d\u5408\u5176\u4ed6\u4e00\u4e9b\u5c5e\u6027\u53ef\u4ee5\u5b9e\u73b0IE,chrome,safria\u6d4f\u89c8\u5668\u4e0b\u6587\u5b57\u6ea2\u51fa\u70b9\u70b9\u70b9\u7701\u7565\u53f7\u663e\u793a\uff0c\u5728\u52a0\u4e0aopera\u6d4f\u89c8\u5668\u7684\u79c1\u6709\u5c5e\u6027-o-text-overflow:ellipsis;\u5c31\u76ee\u524d\u800c\u8a00\uff0c\u53ef\u4ee5\u5b9e\u73b0Firefox\u6d4f\u89c8\u5668\u4ee5\u5916\u7684\u6240\u6709\u4e3b\u6d41\u6d4f\u89c8\u5668\u7684\u6587\u5b57\u6ea2\u51fa\u70b9\u70b9\u70b9\u7701\u7565\u53f7\u663e\u793a\u3002<\/p>\n<p>\u800c\u672c\u6587\u5c06\u63d0\u4f9b\u591a\u79cd\u517c\u5bb9\u6027\u4e0a\u4f73\u7684\u6587\u5b57\u6ea2\u51fa\u70b9\u70b9\u70b9\u7701\u7565\u53f7\u663e\u793a\u7684\u65b9\u6cd5\uff0c\u800c\u91cc\u9762\u4e0d\u5c11\u65b9\u6cd5\u5c31\u662f\u81ea\u5df1\u60f3\u51fa\u6765\u7684\u3002\u6709\u4f7f\u7528\u5916\u90e8\u8f85\u52a9\u6587\u4ef6\u7684\uff0c\u6709\u7eaf\u7cb9\u7684css\u65b9\u6cd5\u7684\uff0c\u8fd8\u6709\u4f7f\u7528jQuery\u65b9\u6cd5\u7684\u3002\u6bcf\u79cd\u65b9\u6cd5\u90fd\u63d0\u4f9b\u5404\u4e2a\u6d4f\u89c8\u5668\u4e0b\u7684\u622a\u56fe\u9a8c\u8bc1\uff0c\u63d0\u4f9b\u5b9e\u4f8b\u9875\u9762\uff0c\u63d0\u4f9b\u90e8\u5206\u6e90\u6587\u4ef6\uff0c\u90fd\u662f\u503c\u5f97\u4fe1\u8d56\u7684\u65b9\u6cd5\uff0c\u5e0c\u671b\u5bf9\u60a8\u6709\u6240\u5e2e\u52a9\u3002\u6587\u7ae0\u4e2d\u7a7f\u63d2\u4e86\u4e9b\u7262\u9a9a\uff0c\u60a8\u53ef\u4ee5\u8df3\u8fc7\uff0c\u4e0e\u672c\u6587\u4e3b\u4f53\u4e0d\u662f\u5f88\u76f8\u5173\u3002<\/p>\n<p>\u60a8\u53ef\u4ee5\u4e8b\u5148\u5355\u51fb\u8fd9\u91cc\uff1a<a class=\"a_link\" href=\"http:\/\/www.zhangxinxu.com\/study\/200909\/text-overflow-ellipsis-so-on.html\" target=\"_blank\">\u672c\u6587\u5404\u7c7b\u65b9\u6cd5\u7684demo\u5b9e\u4f8b\u9875\u9762<\/a>\uff0c\u4e24\u4e2a\u9875\u9762\u5bf9\u6bd4\u6216\u8bb8\u66f4\u6709\u52a9\u4e8e\u7406\u89e3\u548c\u8ba4\u8bc6\u3002<\/p>\n<h3>\u76ee\u5f55<\/h3>\n<p><a href=\"#zxx_a\">1\u3001\u5e38\u89c4css\u65b9\u6cd5\u2014\u2014\u4f7fFirefox\u4ee5\u5916\u4e3b\u6d41\u6d4f\u89c8\u5668\u6587\u5b57\u6ea2\u51fa\u7701\u7565\u53f7\u8868\u793a<\/a><br \/>\n<a href=\"#zxx_b\">2\u3001\u4f7f\u7528ellipsis.xml\u6587\u4ef6\u4f7fFirefox\u652f\u6301\u6587\u5b57\u6ea2\u51fa\u540e\u70b9\u70b9\u70b9\u7701\u7565\u53f7\u8868\u793a<\/a><br \/>\n<a href=\"#zxx_c\">3\u3001\u6211\u5bf9\u7f51\u4e0a\u4e9b\u6587\u7ae0\u548c\u7f51\u7ad9\u7684\u4e0d\u6ee1<\/a><br \/>\n<a href=\"#zxx_d\">4\u3001\u6211\u81ea\u5df1\u60f3\u51fa\u6765\u7684\u65b9\u6cd5\u2014\u2014margin\u8d1f\u503c\u5b9a\u4f4d\u6cd5<\/a><br \/>\n<a href=\"#zxx_e\">5\u3001jQuery\u9650\u5236\u5b57\u7b26\u5b57\u6570\u7684\u65b9\u6cd5<\/a><br \/>\n<a href=\"#zxx_f\">6\u3001jQuery\u81ea\u52a8\u5224\u65ad\u5bbd\u5ea6\u662f\u5426\u8d85\u51fa\u7684\u65b9\u6cd5<\/a><\/p>\n<h4 id=\"zxx_a\">1\u3001\u5e38\u89c4css\u65b9\u6cd5\u2014\u2014\u4f7fFirefox\u4ee5\u5916\u4e3b\u6d41\u6d4f\u89c8\u5668\u6587\u5b57\u6ea2\u51fa\u7701\u7565\u53f7\u8868\u793a<\/h4>\n<p>\u4e0b\u56fe\u4e3a\u6b64\u5e38\u7528\u65b9\u6cd5\u5728\u5404\u4e2a\u6d4f\u89c8\u5668\u4e0b\u7684\u8868\u73b0\uff1a<\/p>\n<div style=\"width: 637px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" title=\"IE6\u6d4f\u89c8\u5668\u4e0b\" src=\"http:\/\/image.zhangxinxu.com\/image\/blog\/200909\/2009-09-05_152800.png\" alt=\"IE6\u6d4f\u89c8\u5668\u4e0b\" width=\"627\" height=\"50\" \/><p class=\"wp-caption-text\">IE6\u6d4f\u89c8\u5668\u4e0b<\/p><\/div>\n<div style=\"width: 621px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" title=\"IE7\u6d4f\u89c8\u5668\u4e0b\" src=\"http:\/\/image.zhangxinxu.com\/image\/blog\/200909\/2009-09-05_153139.png\" alt=\"IE7\u6d4f\u89c8\u5668\u4e0b\" width=\"611\" height=\"52\" \/><p class=\"wp-caption-text\">IE7\u6d4f\u89c8\u5668\u4e0b<\/p><\/div>\n<div style=\"width: 623px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" title=\"chrome\u8c37\u6b4c\u6d4f\u89c8\u5668\u4e0b\" src=\"http:\/\/image.zhangxinxu.com\/image\/blog\/200909\/2009-09-05_153210.png\" alt=\"chrome\u8c37\u6b4c\u6d4f\u89c8\u5668\u4e0b\" width=\"613\" height=\"54\" \/><p class=\"wp-caption-text\">chrome\u8c37\u6b4c\u6d4f\u89c8\u5668\u4e0b<\/p><\/div>\n<div style=\"width: 625px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" title=\"Safari\u6d4f\u89c8\u5668\u4e0b\" src=\"http:\/\/image.zhangxinxu.com\/image\/blog\/200909\/2009-09-05_153250.png\" alt=\"Safari\u6d4f\u89c8\u5668\u4e0b\" width=\"615\" height=\"52\" \/><p class=\"wp-caption-text\">Safari\u6d4f\u89c8\u5668\u4e0b<\/p><\/div>\n<div style=\"width: 622px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" title=\"opera\u6d4f\u89c8\u5668\u4e0b\" src=\"http:\/\/image.zhangxinxu.com\/image\/blog\/200909\/2009-09-05_153313.png\" alt=\"opera\u6d4f\u89c8\u5668\u4e0b\" width=\"612\" height=\"53\" \/><p class=\"wp-caption-text\">opera\u6d4f\u89c8\u5668\u4e0b<\/p><\/div>\n<div style=\"width: 621px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" title=\"Firefox\u706b\u72d0\u6d4f\u89c8\u5668\u4e0b\" src=\"http:\/\/image.zhangxinxu.com\/image\/blog\/200909\/2009-09-05_153808.png\" alt=\"Firefox\u706b\u72d0\u6d4f\u89c8\u5668\u4e0b\" width=\"611\" height=\"59\" \/><p class=\"wp-caption-text\">Firefox\u706b\u72d0\u6d4f\u89c8\u5668\u4e0b<\/p><\/div>\n<p>\u53ef\u4ee5\u770b\u5230\uff0c\u4ec5\u5728Firefox\u706b\u72d0\u6d4f\u89c8\u5668\u4e0b\u65e0\u6cd5\u5b9e\u73b0\u6587\u5b57\u6ea2\u51fa\u7701\u7565\u53f7\u8868\u793a\uff0c\u5176\u6587\u5b57\u76f4\u63a5\u4ece\u4e2d\u95f4\u5494\u6389\u4e86\u3002\u7efc\u5408\u8003\u8651\u4ee3\u7801\u6210\u672c\uff0c\u8868\u73b0\u6548\u679c\uff0c\u6211\u4e2a\u4eba\u89c9\u5f97\u8fd9\u6837\u5b50\u5df2\u7ecf\u7b97\u662f\u4e0d\u9519\u7684\u4e86\uff0c\u8ffd\u6c42\u5b8c\u7f8e\u548c\u5b9e\u9645\u6548\u76ca\u4e4b\u95f4\u8981\u8ffd\u6c42\u4e00\u5b9a\u7684\u5e73\u8861\u3002\u5982\u679c\u9875\u9762\u4e0a\u5f88\u591a\u6587\u5b57\u90fd\u6ea2\u51fa\uff0c\u5219\u9700\u8981\u5bfb\u6c42\u66f4\u517c\u5bb9\u7684\u65b9\u6cd5\uff0c\u8981\u662f\u5076\u5c14\u4f1a\u51fa\u73b0\u6587\u5b57\u6ea2\u51fa\u7684\u60c5\u51b5\uff0c\u5c31\u662f\u7528\u8fd9\u7c7bcss\u4ee3\u7801\u5c31\u8db3\u591f\u4e86\uff0c\u5355\u5c42\u6807\u7b7e\uff0c\u7b80\u5355\u5b9e\u7528\uff1a<\/p>\n<pre>.zxx_text_overflow{width:27em; white-space:nowrap; text-overflow:ellipsis; -o-text-overflow:ellipsis; overflow:hidden;}<\/pre>\n<h4 id=\"zxx_b\">2\u3001\u4f7f\u7528ellipsis.xml\u6587\u4ef6\u4f7fFirefox\u652f\u6301\u6587\u5b57\u6ea2\u51fa\u540e\u70b9\u70b9\u70b9\u7701\u7565\u53f7\u8868\u793a<\/h4>\n<p>\u8fd9\u662f\u8001\u5916\u63d0\u4f9b\u7684\u4e00\u79cd\u65b9\u6cd5\uff0c\u4f7f\u7528Firefox\u7684\u79c1\u6709\u5c5e\u6027\u8c03\u7528\u4e00\u4e2aXML\u6587\u4ef6\uff0c\u53ef\u4ee5\u4f7fFirefox\u706b\u72d0\u6d4f\u89c8\u5668\u4e0b\u6587\u5b57\u6ea2\u51fa\u540e\u4ee5\u7701\u7565\u53f7\u7684\u5f62\u5f0f\u663e\u793a\u3002<br \/>\n\u53f3\u952e\u53e6\u5b58\u4e3a\u4e0b\u8f7d\uff1a<a class=\"a_link\" href=\"http:\/\/www.zhangxinxu.com\/study\/xml\/ellipsis.xml\" target=\"_blank\">ellipsis.xml<\/a><br \/>\n\u8c03\u7528\u65b9\u6cd5\u5982\u4e0b\uff1a<\/p>\n<pre>-moz-binding:url('ellipsis.xml#ellipsis');<\/pre>\n<p>\u8ddfcss\u6837\u5f0f\u5199\u6cd5\u4e00\u81f4\u3002<br \/>\n\u9700\u8981\u6ce8\u610f\u7684\u662f\uff1a\u6b64XML\u6587\u4ef6\u4e0d\u652f\u6301\u5411\u4e0a\u8def\u5f84\u7684\u8bbf\u95ee\uff0c\u4e5f\u4e0d\u652f\u6301\u7edd\u5bf9\u8def\u5f84\u7684\u8bbf\u95ee\u3002\u4e5f\u5c31\u662f\u8bf4\u6b64XML\u6587\u4ef6\u9700\u8981\u653e\u5728\u8c03\u7528\u6587\u4ef6\uff08css\u6587\u4ef6\uff0c\u6216HTML\u6587\u4ef6\uff09\u7684\u540c\u76ee\u5f55\u4e0b\u6216\u4e0b\u4e00\u7ea7\u76ee\u5f55\u4e0b\uff0c\u4e0d\u80fd\u5411\u4e0a\u8bbf\u95ee\u3002\u539f\u56e0\u6211\u662f\u4e0d\u6e05\u695a\u7684\uff0c\u6211\u53cd\u590d\u8bd5\u9a8c\uff0c\u90fd\u8bc1\u660e\u5982\u6b64\u3002<\/p>\n<p>\u4e0b\u56fe\u4e3a\u4f7f\u7528\u6b64XML\u6587\u4ef6\u540eFirefox\u6d4f\u89c8\u5668\u4e0b\u7684\u8868\u73b0\uff1a<\/p>\n<div style=\"width: 611px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" title=\"Firefox\u706b\u72d0\u6d4f\u89c8\u5668\u4e0b\" src=\"http:\/\/image.zhangxinxu.com\/image\/blog\/200909\/2009-09-05_161520.png\" alt=\"Firefox\u706b\u72d0\u6d4f\u89c8\u5668\u4e0b\" width=\"601\" height=\"61\" \/><p class=\"wp-caption-text\">Firefox\u706b\u72d0\u6d4f\u89c8\u5668\u4e0b<\/p><\/div>\n<p>\u53ef\u4ee5\u6e05\u9664\u5730\u770b\u5230\u6ea2\u51fa\u7684\u6587\u5b57\u90e8\u5206\u7528\u70b9\u70b9\u70b9\u7701\u7565\u53f7\u8868\u793a\u4e86\u3002\u518d\u7ed3\u5408\u4e0a\u9762\u7684css\u6837\u5f0f\uff0c\u5c31\u53ef\u4ee5\u5b9e\u73b0\u6240\u6709\u4e3b\u6d41\u6d4f\u89c8\u5668\u4e0b\u7684\u5355\u884c\u6587\u5b57\u6ea2\u51fa\u7528\u7701\u7565\u53f7\u8868\u793a\u4e86\u3002css\u8868\u793a\u5982\u4e0b\uff1a<\/p>\n<pre>.zxx_text_overflow{width:27em; white-space:nowrap; text-overflow:ellipsis; -o-text-overflow:ellipsis; -moz-binding:url('ellipsis.xml#ellipsis'); overflow:hidden;}<\/pre>\n<p>\u4f8b\u5982\u5728<a class=\"a_link\" target=\"_blank\" href=\"http:\/\/www.zhangxinxu.com\/study\/200909\/text-overflow-ellipsis-so-on.html\">\u5b9e\u4f8b\u9875\u9762<\/a>\u4e2d\uff0c\u6b64\u6bb5css\u662f\u5199\u5728\u9875\u9762\u4e0a\u7684\uff0c\u6240\u4ee5ellipsis.xml\u6587\u4ef6\u662f\u653e\u5728HTML\u6587\u4ef6\u540c\u76ee\u5f55\u4e0b\u7684\u3002<\/p>\n<h4 id=\"zxx_c\">3\u3001\u6211\u5bf9\u7f51\u4e0a\u4e9b\u6587\u7ae0\u548c\u7f51\u7ad9\u7684\u4e0d\u6ee1<\/h4>\n<p>\u6628\u5929\u7f16\u5199demo\u5b9e\u4f8b\u9875\u9762\uff0c\u60f3\u627e\u4e4b\u524d\u770b\u8fc7\u7684\u4e00\u4e2a\u540c\u4ec1\u63d0\u8fc7\u7684\u56fe\u7247\u663e\u793a\u7701\u7565\u53f7\u7684\u65b9\u6cd5\uff0c\u7ed3\u679c\u53d1\u73b0\u5f88\u591a\u6253\u7740\u79f0\u53f7\u517c\u5bb9\u201cIE\uff0cFF\u201d\u7684\u6587\u7ae0\uff0c\u4e0d\u9519\u554a\uff0c\u4e8e\u662f\u6211\u770b\u770b\u662f\u4ec0\u4e48\u65b9\u6cd5\u3002\u7ed3\u679c\u4e00\u809a\u5b50\u7684\u706b\u3002<\/p>\n<div style=\"width: 568px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" title=\"\u6240\u8c13\u7684\u517c\u5bb9IE\uff0cFF\u7684\u6587\u7ae0\" src=\"http:\/\/image.zhangxinxu.com\/image\/blog\/200909\/2009-09-05_162802.png\" alt=\"\u6240\u8c13\u7684\u517c\u5bb9IE\uff0cFF\u7684\u6587\u7ae0\" width=\"558\" height=\"465\" \/><p class=\"wp-caption-text\">\u6240\u8c13\u7684\u517c\u5bb9IE\uff0cFF\u7684\u6587\u7ae0<\/p><\/div>\n<p>\u56fe\u4e2d\u663e\u793a\u7684\u662fGoogle\u641c\u7d22\u540e\u7684\u524d\u4e94\u9879\uff0c\u5176\u4e2d\u6709\u56db\u4e2a\u662f\u6240\u8c13\u7684\u5efa\u7ad9\u6559\u7a0b\u7f51\u7ad9\uff0c\u8fd9\u56db\u4e2a\u53c8\u662f\u540c\u4e00\u7bc7\u6587\u7ae0\u3002<br \/>\n\u8fd9\u7bc7\u6587\u7ae0\u5f88\u4e0d\u8d1f\u8d23\uff0c\u5c45\u7136\u662f\u6211\u5f88\u4e45\u4e4b\u524d\u5c31\u60f3\u8fc7\u4e14\u6d4b\u8fc7\uff0c\u7531\u4e8e\u517c\u5bb9\u6027\u7b49\u7b49\u95ee\u9898\u800c\u4e0d\u91c7\u7528\u7684\u65b9\u6cd5\u3002\u7528:after\u4f2a\u7c7b\u548ccontent\u5728\u6587\u5b57\u540e\u9762\u52a0\u7701\u7565\u53f7\u3002\u8fd9\u4e2a\u65b9\u6cd5\u53ef\u4ee5\u8bf4\u662f\u5b8c\u5168\u884c\u4e0d\u901a\u3002<\/p>\n<p>\u9996\u5148\uff0c\u6807\u9898\u5c31\u662f\u4e2a\u5927\u5927\u7684\u9519\u8bef\uff0c\u4ec0\u4e48\u517c\u5bb9\u201cIE\uff0cFF\u201d\uff1f\u7b2c\u4e00\u3001chrome\u4e0d\u7b97\u6d4f\u89c8\u5668\u5417\uff1f\u770b\u8fd9\u6587\u7ae0\u65f6\u95f4\uff0cchrome\u5df2\u7ecf\u51fa\u6765\u4e86\uff0cSafari\uff0copera\u4e0d\u7b97\u6d4f\u89c8\u5668\u5417\uff1f\u5c31\u53ea\u8981\u517c\u5bb9IE\uff0cFF\u5c31\u53ef\u4ee5\u4e86\u5417\uff1f\u7b2c\u4e8c\u3001\u4f60\u517c\u5bb9IE\uff0cFF\u5417\uff1f\u4ec0\u4e48\u53eb\u517c\u5bb9\uff0c\u5c31\u662f\u8981\u8868\u73b0\u4e00\u6837\u3002\u4e24\u4e2a\u6d4f\u89c8\u5668\u4e0b\u8868\u73b0\u4e00\u81f4\u5417\uff1f\u5dee\u8fdc\u4e86\uff01\u7b2c\u4e09\u3001\u4f60\u517c\u5bb9IE\u5417\uff1fIE6\u548cIE7\u4e0b\u90fd\u5929\u5dee\u5730\u522b\u7684\uff0c\u8fd8\u8bf4\u4ec0\u4e48\u517c\u5bb9\u5462\uff01<\/p>\n<p>\u770b\u8fd9\u6587\u7ae0\u7684\u610f\u601d\uff0c\u8fd9\u4e16\u754c\u4e0a\u5c31\u53ea\u6709\u4e24\u79cd\u6d4f\u89c8\u5668\uff0cIE6\u548cFirefox\uff0c\u6211\u4e0d\u77e5\u9053\u4f5c\u8005\u662f\u4e2a\u5f88\u5927\u7684\u8349\u5305\u8fd8\u662f\u4e0a\u4e16\u7eaa\u65f6\u7a7a\u8f6c\u79fb\u8fc7\u6765\u7684\u7a0b\u5e8f\u5458\uff0c\u7528\u53e5\u8d64\u58c1\u91cc\u7684\u8bdd\u8bf4\u5c31\u662f\u201c\u4f60\u8fc7\u65f6\u4e86\uff01\u201d<\/p>\n<p>\u5176\u6b21\uff0c\u65b9\u6cd5\u7f3a\u9677\u5f88\u591a\uff1a1\u3001\u8bf4\u662f\u517c\u5bb9\uff0c\u5176\u5b9e\u53cd\u800c\u5927\u5927\u7834\u574f\u4e86\u517c\u5bb9\u6027\uff0cIE6\u548cIE7\u4e0b\u7684\u8868\u73b0\u5c31\u4e0d\u4e00\u6837\uff0c\u4e00\u53e5IE\u201c\u4e0d\u652f\u6301<code>max-width<\/code>\u201d\u5c31\u8ba9\u6211\u60f3\u7ed9\u4f5c\u8005\u6247\u4e2a\u8033\u5149\uff0cIE7\u4e0d\u652f\u6301\u5417\uff0c\u522b\u544a\u8bc9\u6211\u4f60\u5199\u8fd9\u6587\u7ae0\u65f6\u8fd8\u6ca1\u6709IE7\u6d4f\u89c8\u5668\u30022\u3001\u672c\u6765chrome\u6d4f\u89c8\u5668\uff0cSafari\u8fd8\u6709opera\u53ef\u4ee5\u5b9e\u73b0\u6587\u5b57\u6ea2\u51fa\u7701\u7565\u53f7\u663e\u793a\u7684\uff0c\u73b0\u5728\u53d7\u9650\u4e0e<code>:after<\/code>\u548c<code>content<\/code>\uff0c\u5c31\u4f1a\u4e00\u5904\u7406\u4e0d\u5f53\uff0c\u6587\u5b57\u76f4\u63a5\u88ab\u622a\uff0c\u5c31\u5f88\u4e11\u4e86\u30023\u3001\u591a\u5957\u7528\u4e86\u4e00\u5c42\u6807\u7b7e\uff0ccss\u4e5f\u591a\u4e86\u597d\u51e0\u884c\uff0c\u6ca1\u6709\u5fc5\u8981\uff0c\u8d44\u6e90\u6d88\u8017\u9ad8\u30024\u3001\u5f53\u6587\u5b57\u5f88\u77ed\u65f6\u540e\u9762\u4e5f\u8fd8\u8ddf\u7740\u4e2a\u7701\u7565\u53f7\uff0c\u6ca1\u6709\u6ea2\u51fa\u4e3a\u4ec0\u4e48\u8fd8\u8981\u663e\u793a\u7701\u7565\u53f7\u5462\uff1f<\/p>\n<p>\u65e0\u8bba\u662f\u517c\u5bb9\u6027\uff0c\u8d44\u6e90\u5360\u7528\uff0c\u903b\u8f91\u8868\u73b0\u90fd\u662f\u5f88\u5c4e\u7684\uff0c\u662f\u4e2a\u5b8c\u5168\u4e0d\u80fd\u7528\u7684\u65b9\u6cd5\u3002<\/p>\n<p>\u6211\u4e0d\u662f\u6124\u6168\u4f5c\u8005\u6280\u672f\u4e0d\u884c\uff0c\u800c\u662f\u4e0d\u6ee1\u6ca1\u6709\u4e00\u70b9\u9053\u4e49\u548c\u79d1\u7814\u7d20\u517b\u3002\u7741\u7740\u773c\u775b\u8bf4\u778e\u8bdd\uff0c\u90fd\u662f\u6ca1\u6709\u7ecf\u8fc7\u9a8c\u8bc1\u7684\u4e1c\u897f\uff0c\u51ed\u611f\u89c9\u5927\u653e\u53a5\u8bcd\u3002\u6211\u66f4\u9119\u89c6\u90a3\u4e9b\u6240\u8c13\u7684\u6559\u7a0b\u7f51\u7ad9\uff0c\u8fd9\u4e9b\u7f51\u7ad9\u4ec0\u4e48\u6559\u7a0b\u90fd\u62ff\u6765\u7684\uff0c\u5b83\u53ea\u7ba1\u70b9\u51fb\u7387\uff0c\u4e0d\u7ba1\u662f\u5426\u6b63\u786e\u5b9e\u7528\uff0cn\u5e74\u524d\u6dd8\u6c70\u7684\u4e1c\u897f\u5b83\u4e5f\u62ff\u6765\uff0c\u8bef\u4eba\u5b50\u5f1f\u554a\uff01\u6211\u5c31\u5f88\u7eb3\u95f7\uff0c\u8fd9\u4e9b\u7f51\u7ad9\u65e0\u8bba\u8bbe\u8ba1\uff0c\u8fd8\u662f\u5e03\u5c40\uff0c\u6216\u662f\u9875\u9762\u7684\u517c\u5bb9\u6027\u90fd\u5dee\u7684\u8ddf\u5768\u915d\u917f\u5f88\u4e45\u7684\u732a\u5c4e\u4e00\u6837\uff0c\u8fd8\u6559\u522b\u4eba\u600e\u4e48\u505a\u7f51\u7ad9\u3002\u6211\u662f\u770b\u7a7f\u4e86\uff0c\u5176\u5b9e\u8fd9\u7bc7\u6587\u7ae0\u4e0d\u884c\u4ed6\u4eec\u662f\u77e5\u9053\u7684\uff0c\u53ef\u4ee5\u6ca1\u6709\u529e\u6cd5\u554a\uff0c\u201c\u517c\u5bb9IE\uff0cFF\u201d\uff0c\u591a\u8bf1\u4eba\u7684\u5173\u952e\u8bcd\u554a\uff01\u4e0d\u7ba1\u600e\u6837\uff0c\u5f97\u62ff\u7bc7\u6587\u7ae0\u6765\u5360\u4f4f\u8fd9\u51e0\u4e2a\u5173\u952e\u8bcd\u554a\uff01\u6d41\u91cf\u7ed9\u4e86\u522b\u4eba\u53ef\u4e0d\u884c\u554a\uff01\u8fd9\u4e9b\u552f\u5229\u662f\u56fe\u7684\u7f51\u7ad9\uff0c\u5c06\u4e00\u7bc7\u5b8c\u5168\u4e0d\u884c\u7684\u6587\u7ae0\u4f20\u6765\u4f20\u53bb\uff0c\u5c31\u4e3a\u4e86\u70b9\u7834\u70b9\u51fb\u7387\u3002\u8fd9\u8ddf\u4e09\u9e7f\u6709\u4ec0\u4e48\u533a\u522b\uff0c\u505a\u6559\u7a0b\u7684\uff0c\u662f\u6559\u4eba\u7684\uff0c\u968f\u4fbf\u62ff\u4e00\u4e9b\u9519\u8bef\u7684\u4e1c\u897f\u7cca\u5f04\u4eba\uff0c\u5bb3\u4e86\u591a\u5c11\u4eba\u554a\uff0c\u771f\u662f\u592a\u6ca1\u6709\u9053\u4e49\u4e86\uff01<\/p>\n<h4 id=\"zxx_d\">4\u3001\u6211\u81ea\u5df1\u60f3\u51fa\u6765\u7684\u65b9\u6cd5\u2014\u2014margin\u8d1f\u503c\u5b9a\u4f4d\u6cd5<\/h4>\n<p>\u8fd9\u91cc\u5148\u4e0a\u4ee3\u7801\uff0cHTML\u90e8\u5206\uff1a<\/p>\n<div class=\"zxx_code\">\n<pre>&lt;div class=\"zxx_text_overflow\" &gt;\n     &lt;div class=\"zxx_con\" &gt;\u8fd9\u662f\u4e00\u6bb5\u6bd4\u8f83\u957f\u7684\u6587\u5b57\uff0c\u7528\u6765\u6d4b\u8bd5\u662f\u5426\u6587\u5b57\u6ea2\u51fa\u65f6\u4f1a\u7528\u7701\u7565\u53f7\u663e\u793a\u3002&lt;\/div&gt;\n     &lt;div class=\"zxx_dotted\" &gt;\u2026&lt;\/div&gt;\n &lt;\/div&gt;<\/pre>\n<\/div>\n<p>css\u90e8\u5206\uff1a<\/p>\n<pre>.zxx_text_overflow{width:24em; height:1.3em; overflow:hidden; zoom:1;}\n.zxx_text_overflow .text_con{float:left; height:1.3em; margin-right:3em; overflow:hidden;}\n.zxx_text_overflow .text_dotted{width:3em; height:1.31em; float:right; margin-top:-1.3em;}<\/pre>\n<p>\u7ed3\u679c\u5728\u4e0d\u540c\u6d4f\u89c8\u5668\u4e0b\u7684\u8868\u73b0\u5982\u4e0b\uff08IE6\uff0cIE7\u4ee5IE6\u793a\u4f8b\uff0cFirefox\u548cchrome\u4ee5Firefox\u793a\u4f8b\uff09\uff1a<\/p>\n<div style=\"width: 537px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" title=\"IE6\u4e0b\uff0cIE7\u540c\u7c7b\u578b\uff0c\u8868\u73b0\u4e00\u81f4-\u5f20\u946b\u65ed-\u946b\u7a7a\u95f4-\u946b\u751f\u6d3b\" src=\"http:\/\/image.zhangxinxu.com\/image\/blog\/200909\/2009-09-05_171924.png\" alt=\"IE6\u4e0b\uff0cIE7\u540c\u7c7b\u578b\uff0c\u8868\u73b0\u4e00\u81f4\" width=\"527\" height=\"78\" \/><p class=\"wp-caption-text\">IE6\u4e0b\uff0cIE7\u540c\u7c7b\u578b\uff0c\u8868\u73b0\u4e00\u81f4<\/p><\/div>\n<div style=\"width: 537px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" title=\"Firefox\u6d4f\u89c8\u5668\u4e0b\u8868\u73b0-\u5f20\u946b\u65ed-\u946b\u7a7a\u95f4-\u946b\u751f\u6d3b\" src=\"http:\/\/image.zhangxinxu.com\/image\/blog\/200909\/2009-09-05_171951.png\" alt=\"Firefox\u6d4f\u89c8\u5668\u4e0b\u8868\u73b0\" width=\"527\" height=\"78\" \/><p class=\"wp-caption-text\">Firefox\u6d4f\u89c8\u5668\u4e0b\u8868\u73b0<\/p><\/div>\n<div style=\"width: 537px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" title=\"opera\u6d4f\u89c8\u5668\u4e0b\u8868\u73b0-\u5f20\u946b\u65ed-\u946b\u7a7a\u95f4-\u946b\u751f\u6d3b\" src=\"http:\/\/image.zhangxinxu.com\/image\/blog\/200909\/2009-09-05_172028.png\" alt=\"opera\u6d4f\u89c8\u5668\u4e0b\u8868\u73b0\" width=\"527\" height=\"78\" \/><p class=\"wp-caption-text\">opera\u6d4f\u89c8\u5668\u4e0b\u8868\u73b0<\/p><\/div>\n<div style=\"width: 537px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" title=\"Safari\u6d4f\u89c8\u5668\u4e0b\u8868\u73b0-\u5f20\u946b\u65ed-\u946b\u7a7a\u95f4-\u946b\u751f\u6d3b\" src=\"http:\/\/image.zhangxinxu.com\/image\/blog\/200909\/2009-09-05_172059.png\" alt=\"Safari\u6d4f\u89c8\u5668\u4e0b\u8868\u73b0\" width=\"527\" height=\"78\" \/><p class=\"wp-caption-text\">Safari\u6d4f\u89c8\u5668\u4e0b\u8868\u73b0<\/p><\/div>\n<p><strong>\u7b80\u8981\u8bf4\u660e\uff1a<\/strong>\u6b64\u65b9\u6cd5\u517c\u5bb9IE6\uff0cIE7\uff08IE8\u672a\u6d4b\u8fc7\uff09\uff0cFirefox\uff0cchrome\uff0cSafari\uff0copera\u6d4f\u89c8\u5668\u3002\u6ca1\u6709hack\uff0c\u6ca1\u6709\u751f\u50fb\u7684css\u6837\u5f0f\u3002\u6587\u5b57\u77ed\u65f6\uff0c\u6ca1\u6709\u7701\u7565\u53f7\uff0c\u6587\u5b57\u6ea2\u51fa\u65f6\u5c31\u51fa\u73b0\u7701\u7565\u53f7\u3002\u53ef\u4ee5\u8bf4\u662f\u76f8\u5f53\u4e0d\u9519\u7684\u4e00\u4e2a\u65b9\u6cd5\u3002\u539f\u7406\u4e5f\u5f88\u7b80\u5355\uff1a\u5f53\u6587\u5b57\u5185\u5bb9\u8db3\u591f\u957f\u65f6\u5c31\u628a\u9690\u85cf\u5728\u4e0a\u9762\u7684\u7701\u7565\u53f7\u5c42\u7ed9\u6324\u4e0b\u6765\u4e86\u3002\u5173\u952e\u5c31\u662f\u70b9\u70b9\u70b9\u6240\u5728div\u5c42\u7684\u9ad8\u5ea6\u7684\u7edd\u5bf9\u503c\u8981\u6bd4\u5176margin\u7684\u7edd\u5bf9\u503c\u5927\u90a3\u4e48\u4e00\u70b9\u70b9\u3002 \u5982\u679c\u60a8\u4e0d\u4e60\u60ef\u7528em\u505a\u5355\u4f4d\uff0c\u76f4\u63a5\u6362\u4f5cpx\u5c31\u53ef\u4ee5\u4e86\uff0c\u6548\u679c\u662f\u4e00\u6837\u7684\u3002<\/p>\n<h4 id=\"zxx_e\">5\u3001jQuery\u9650\u5236\u5b57\u7b26\u5b57\u6570\u7684\u65b9\u6cd5<\/h4>\n<p>\u4ee3\u7801\u5f88\u7b80\u5355\uff0c\u4f7f\u7528\u4e5f\u5f88\u65b9\u4fbf\uff0c\u5982\u4e0b\uff1a<\/p>\n<pre>\n\/\/\u9650\u5236\u5b57\u7b26\u4e2a\u6570\n$(\".zxx_text_overflow\").each(function(){\n  var maxwidth=<span style=\"color:#f00;\">23<\/span>;\n  if($(this).text().length &gt; maxwidth){\n    $(this).text($(this).text().substring(0,maxwidth));\n    $(this).html($(this).html()+'...');\n  }\n});\n<\/pre>\n<p>\u6240\u4ea7\u751f\u7684\u7ed3\u679c\u662f\uff1a\u9875\u9762\u4e2d<code>class<\/code>\u4e3a<code>\"zxx_text_overflow\"<\/code>\u7684\u6807\u7b7e\u5185\u90e8\u5b57\u7b26\u7684\u4e2a\u6570\u5c06\u6700\u591a\u663e\u793a<code>23<\/code>\u4e2a\uff0c\u5982\u679c\u539f\u672c\u5b57\u7b26\u4e2a\u6570\u5927\u4e8e<code>23<\/code>\uff0c\u5219\u4f1a\u5728\u540e\u9762\u6dfb\u52a0\u70b9\u70b9\u70b9\u7701\u7565\u53f7\uff08<code>...<\/code>\uff09\uff0c\u5982\u4e0b\u56fe\u6240\u793a\u7684\uff1a<\/p>\n<div style=\"width: 412px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" title=\"jQuery\u9650\u5236\u5b57\u7b26\u4e2a\u6570\u5b9e\u73b0\u6ea2\u51fa\u7701\u7565\u53f7\u8868\u793a\" src=\"http:\/\/image.zhangxinxu.com\/image\/blog\/200909\/2009-09-05_173836.png\" alt=\"jQuery\u9650\u5236\u5b57\u7b26\u4e2a\u6570\u5b9e\u73b0\u6ea2\u51fa\u7701\u7565\u53f7\u8868\u793a\" width=\"402\" height=\"83\" \/><p class=\"wp-caption-text\">jQuery\u9650\u5236\u5b57\u7b26\u4e2a\u6570\u5b9e\u73b0\u6ea2\u51fa\u7701\u7565\u53f7\u8868\u793a<\/p><\/div>\n<h4 id=\"zxx_f\">6\u3001jQuery\u81ea\u52a8\u5224\u65ad\u5bbd\u5ea6\u662f\u5426\u8d85\u51fa\u7684\u65b9\u6cd5<\/h4>\n<p>\u76f8\u6bd4\u8f83\u524d\u9762\u4e00\u79cd\u65b9\u6cd5\uff0c\u8fd9\u4e2ajs\u5b9e\u73b0\u7684\u65b9\u6cd5\u66f4\u52a0\u667a\u80fd\u4e9b\uff08\u4e5f\u66f4\u5360\u7528\u8d44\u6e90\uff09\uff0c\u901a\u8fc7\u590d\u5236\u8282\u70b9\uff08\u5c31\u662f\u9700\u8981\u5224\u65ad\u662f\u5426\u6587\u5b57\u6ea2\u51fa\u7701\u7565\u53f7\u663e\u793a\u7684\u6807\u7b7e\u5c42\uff09\uff0c\u83b7\u53d6\u5176\u5bbd\u5ea6\uff0c\u518d\u5224\u65ad\u5176\u5bbd\u5ea6\u662f\u5426\u5927\u4e8e\u6837\u5f0f\u4e2d\u7ed9\u5b9a\u7684\u5bbd\u5ea6\u9650\u503c\uff0c\u5927\u4e8e\u5219\u53bb\u6389\u5c3e\u90e8\u5b57\u7b26\uff0c\u6dfb\u52a0\u7701\u7565\u53f7\uff0c\u5faa\u73af\uff0c\u76f4\u5230\u590d\u5236\u7684\u5c42\u7684\u5bbd\u5ea6\u5c0f\u4e8ecss\u7ed9\u5b9a\u503c\u3002<br \/>\njs\u4ee3\u7801\u5982\u4e0b\uff1a<\/p>\n<pre>\nvar wordLimit=function(){\n  $(\".zxx_text_overflow\").each(function(){\n    var copyThis = $(this.cloneNode(true)).hide().css({\n      'position': 'absolute',\n      'width': 'auto',\n      'overflow': 'visible'\n    });\n    $(this).after(copyThis);\n    if (copyThis.width()&gt;$(this).width()) {\n      $(this).text($(this).text().substring(0, $(this).html().length-4));\n      $(this).html($(this).html()+'...');\n      copyThis.remove();\n      wordLimit();\n    } else {\n      \/\/\u6e05\u9664\u590d\u5236\n      copyThis.remove(); \n    }\n  });\n}\nwordLimit();\n<\/pre>\n<p>css\u90e8\u5206\u9700\u8981\u7ed9\u5b9a\u4e00\u4e2a\u5bbd\u5ea6\u503c\uff0c\u4f8b\u5982\uff1a<\/p>\n<pre>.zxx_text_overflow { width: 400px; }<\/pre>\n<p>\u7ed3\u679c\u5982\u4e0b\uff1a<\/p>\n<div style=\"width: 490px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" title=\"jQuery\u5bbd\u5ea6\u5224\u5b9a\u5b9e\u73b0\u6ea2\u51fa\u7701\u7565\u53f7\u8868\u793a\" src=\"http:\/\/image.zhangxinxu.com\/image\/blog\/200909\/2009-09-05_174935.png\" alt=\"jQuery\u5bbd\u5ea6\u5224\u5b9a\u5b9e\u73b0\u6ea2\u51fa\u7701\u7565\u53f7\u8868\u793a\" width=\"480\" height=\"77\" \/><p class=\"wp-caption-text\">jQuery\u5bbd\u5ea6\u5224\u5b9a\u5b9e\u73b0\u6ea2\u51fa\u7701\u7565\u53f7\u8868\u793a<\/p><\/div>\n<p>\u72e0\u72e0\u5730\u70b9\u51fb\u8fd9\u91cc\uff1a<a class=\"a_link\" href=\"http:\/\/www.zhangxinxu.com\/study\/200909\/text-overflow-ellipsis-so-on.html\" target=\"_blank\">\u672c\u6587\u5404\u7c7b\u65b9\u6cd5\u7684demo\u5b9e\u4f8b\u9875\u9762<\/a><\/p>\n<p><strong>\u6700\u540e\u8865\u5145\uff1a<\/strong><br \/>\n\u6211\u62bd\u4e86\u4e00\u4f1a\u513f\u65f6\u95f4\u628a\u4e0a\u9762\u4e24\u4e2ajQuery\u7684\u65b9\u6cd5\u7ed3\u5408\u8d77\u6765\uff0c\u5199\u4e86\u4e2a\u5c0f\u5c0f\u7684jQuery\u63d2\u4ef6\uff0c\u65b9\u4fbf\u5bf9jQuery\u611f\u5174\u8da3\u7684\u4eba\u76f4\u63a5\u4f7f\u7528\u4e86\u3002<br \/>\n\u8fd9\u4e2a\u5355\u884c\u6587\u5b57\u6ea2\u51fa\u7528\u70b9\u70b9\u70b9\u7701\u7565\u53f7\u663e\u793a\u7684jQuery\u63d2\u4ef6\u7684\u4f7f\u7528\u5f88\u7b80\u5355\u3002\u4f8b\u5982\uff1a<\/p>\n<pre>\n$(\".test1\").wordLimit();\n<\/pre>\n<p>\u81ea\u52a8\u83b7\u53d6css\u5bbd\u5ea6\u8fdb\u884c\u5904\u7406\uff0c\u5982\u679ccss\u4e2d\u672a\u5bf9.test1\u7ed9\u5b9a\u5bbd\u5ea6\uff0c\u5219\u4e0d\u8d77\u4f5c\u7528<\/p>\n<pre>$(\".test2\").wordLimit(24);<\/pre>\n<p>\u622a\u53d6\u5b57\u7b26\u6570\uff0c\u503c\u4e3a\u5927\u4e8e0\u7684\u6574\u6570\uff0c\u8fd9\u91cc\u8868\u793aclass\u4e3atest2\u7684\u6807\u7b7e\u5185\u5b57\u7b26\u6570\u6700\u591a24\u4e2a<\/p>\n<p><code>$.wordLimit()<\/code>\u91cc\u9762\u4e3a\u7a7a\u5219\u6839\u636e\u5bbd\u5ea6\u81ea\u52a8\u622a\u53d6\uff0c\u6709\u503c\u7684\u8bdd\u5c31\u6309\u7167\u5b57\u7b26\u6570\u8fdb\u884c\u622a\u53d6\u4e86\u3002<\/p>\n<p><a class=\"a_link\" target=\"_blank\" href=\"http:\/\/www.zhangxinxu.com\/study\/js\/jquery.ellipsis.js\">\u6b64\u63d2\u4ef6js\u4e0b\u8f7d<\/a>\uff08\u53f3\u952e\uff0c\u53e6\u5b58\u4e3a\uff09<br \/>\n<a class=\"a_link\" target=\"_blank\" href=\"http:\/\/www.zhangxinxu.com\/study\/down\/jquery-ellipsis-text-overflow.zip\">\u6e90\u6587\u4ef6\u6253\u5305\u4e0b\u8f7d<\/a>(zip 18.6K)<\/p>\n<p>\u72e0\u72e0\u5730\u70b9\u51fb\u8fd9\u91cc\uff1a<a class=\"a_link\" target=\"_blank\" href=\"http:\/\/www.zhangxinxu.com\/study\/200909\/jquery-text-overflow-ellipsis.html\">\u6587\u5b57\u6ea2\u51fa\u7701\u7565\u53f7\u663e\u793ajQuery\u63d2\u4ef6\u4f7f\u7528demo\u5b9e\u4f8b\u9875\u9762<\/a><\/p>\n<h3>\u6587\u5b57\u6ea2\u51fa\u70b9\u70b9\u70b9\u7ed3\u8bed<\/h3>\n<p>css\uff0cjs\u7b49\u524d\u7aef\u6280\u672f\u535a\u5927\u7cbe\u6df1\uff0c\u80af\u5b9a\u8fd8\u6709\u5176\u4ed6\u66f4\u597d\u7684\u89e3\u51b3\u65b9\u6cd5\uff0c\u8fd9\u91cc\u53ea\u662f\u628a\u6211\u6240\u77e5\u9053\u7684\u5199\u4e0b\u6765\uff0c\u5e0c\u671b\u5bf9\u5176\u4ed6\u4eba\u6709\u6240\u5e2e\u52a9\u3002\u6280\u672f\u7684\u8fdb\u6b65\u662f\u6c38\u4e0d\u505c\u606f\u7684\uff0c\u6216\u8bb8\u4e00\u4e24\u5e74\u540e\uff0c\u6211\u7684\u8fd9\u4e2a\u6587\u7ae0\u91cc\u6240\u63d0\u5230\u7684\u4e9b\u65b9\u6cd5\u4f1a\u6210\u4e3a\u8fc7\u65f6\u7684\u4e1c\u897f\u7684\u3002\u5e0c\u671b\u5982\u6b64\uff01<\/p>\n<p><strong>\u66f4\u65b0\u4e8e2010-04-16<\/strong><br \/>\n\u6709\u4e0d\u5c11\u540c\u884c\u8be2\u95ee\u5f53\u542b\u6709a\u6807\u7b7e\u94fe\u63a5\u7684\u65f6\u5019\u5982\u4f55\u89e3\u51b3\u70b9\u70b9\u70b9\u663e\u793a\u7684\u95ee\u9898\uff0c\u5728\u672c\u6587\u7684\u8bc4\u8bba9\uff0c\u6211\u63d0\u51fa\u4e86\u89e3\u51b3\u65b9\u6848\uff0c\u60a8\u8981\u662f\u9047\u5230\u540c\u6837\u7684\u95ee\u9898\uff0c\u53ef\u4ee5\u5728\u8bc4\u8bba9\u5904\u67e5\u770b\u3002<\/p>\n<p><strong>\u66f4\u65b0\u4e8e2013-04-22<\/strong><br \/>\n\u65e9\u5728\u53bb\u5e74\uff0c\u6240\u6709\u6d4f\u89c8\u5668\u90fd\u5df2\u7ecf\u652f\u6301<code>text-overflow:ellipsis;<\/code>\u65b9\u6cd5\uff0c\u56e0\u6b64\uff0c\u672c\u6587\u5f88\u591a\u5185\u5bb9out\u4e86\uff01<\/p>\n<p><strong>\u66f4\u65b0\u4e8e2015-10-08<\/strong><br \/>\n\u5bf9\u4e8e\u73b0\u4ee3\u6d4f\u89c8\u5668\uff0c\u4f8b\u5982webkit\u5185\u6838\u7684\u6d4f\u89c8\u5668\uff0c\u6216\u8005\u79fb\u52a8\u7aef\uff0c\u662f\u53ef\u4ee5\u5b9e\u73b0\u591a\u884c\u6587\u672c\u5185\u5bb9\u8d85\u51fa\u70b9\u70b9\u70b9&#8230;\u6700\u540e\u4e00\u884c\u663e\u793a\u7684\uff0c\u5178\u578b\u7684CSS\u7ec4\u5408\u5982\u4e0b\uff1a<\/p>\n<pre>.box {\n    display: -webkit-box;\n    -webkit-line-clamp: 3;\n    -webkit-box-orient: vertical;\n}<\/pre>\n<p>\u5176\u4e2d<code>-webkit-line-clamp<\/code>\u5c31\u662f\u63a7\u5236\u884c\u6570\u7684\uff0c\u662f<code>3<\/code>\u5c31\u662f\u663e\u793a3\u884c\uff0c3\u884c\u7ed3\u675f\u70b9\u70b9\u70b9\uff0c\u5982\u679c\u662f<code>2<\/code>\u5219\u6700\u591a2\u884c\u3002<\/p>\n<p>\u60a8\u53ef\u4ee5\u72e0\u72e0\u5730\u70b9\u51fb\u8fd9\u91cc\uff1a<a class=\"a_link\" href=\"http:\/\/www.zhangxinxu.com\/study\/201510\/webkit-line-clamp-text-overflow-ellipsis.html\" target=\"_blank\">\u591a\u884c\u6587\u5b57\u6ea2\u51fa\u70b9\u70b9\u70b9&#8230;\u663e\u793ademo<\/a><\/p>\n<p>\u4f60\u5c31\u4f1a\u770b\u5230\u4f60\u60f3\u8981\u7684\uff01<img decoding=\"async\" src=\"http:\/\/mat1.gtimg.com\/www\/mb\/images\/face\/4.gif\" align=\"absmiddle\"><\/p>\n<p>\u672c\u6587\u4e3a\u539f\u521b\u6587\u7ae0\uff0c\u8f6c\u8f7d\u8bf7\u6ce8\u660e\u6765\u81ea<a href=\"http:\/\/www.zhangxinxu.com\/\">\u5f20\u946b\u65ed-\u946b\u7a7a\u95f4-\u946b\u751f\u6d3b<\/a>[<a href=\"http:\/\/www.zhangxinxu.com\/\">http:\/\/www.zhangxinxu.com<\/a>]<br \/>\n\u672c\u6587\u5730\u5740\uff1a<a href=\"http:\/\/www.zhangxinxu.com\/wordpress\/?p=230\">http:\/\/www.zhangxinxu.com\/wordpress\/?p=230<\/a><\/p>\n<p>\uff08\u672c\u7bc7\u5b8c\uff09<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728\u5b9e\u9645\u7684\u9879\u76ee\u4e2d\uff0c\u7531\u4e8e\u6587\u5b57\u5185\u5bb9\u7684\u957f\u5ea6\u4e0d\u786e\u5b9a\u6027\u548c\u9875\u9762\u5e03\u5c40\u7684\u56fa\u5b9a\u6027\uff0c\u96be\u514d\u4f1a\u51fa\u73b0\u6587\u5b57\u5185\u5bb9\u8d85\u8fc7div\uff08\u6216\u5176\u4ed6\u6807\u7b7e\uff0c\u4e0b\u540c\uff09\u533a\u57df\u7684\u60c5\u51b5\uff0c\u6b64\u65f6\u6bd4\u8f83\u597d\u7684\u505a\u6cd5\u5c31\u662f\u5f53\u6587\u5b57\u8d85\u8fc7\u9650\u5b9a\u7684div\u5bbd\u5ea6\u540e\u81ea\u52a8\u4ee5\u7701\u7565\u53f7\uff08&#8230;\uff09\u663e\u793a\uff0c\u8fd9\u6837\uff0c\u6309\u7167\u4e60\u60ef\uff0c\u4eba\u4eec\u90fd\u4f1a\u77e5\u9053\u8fd9\u513f\u6709\u6587\u5b57\u88ab\u7701\u7565\u4e86\u3002css\u4e2d\u6709\u4e2a\u5c5e\u6027\u53eb\u505atext-overflow:ellipsis;\u914d\u5408\u5176\u4ed6\u4e00\u4e9b\u5c5e\u6027\u53ef\u4ee5\u5b9e\u73b0IE,chrome,safria\u6d4f\u89c8\u5668\u4e0b\u6587\u5b57\u6ea2\u51fa\u70b9\u70b9\u70b9\u7701\u7565\u53f7\u663e\u793a\uff0c\u5728\u52a0\u4e0aopera\u6d4f\u89c8\u5668\u7684\u79c1\u6709\u5c5e\u6027-o-text-overflow:ellipsis;\u5c31\u76ee\u524d\u800c\u8a00\uff0c\u53ef\u4ee5\u5b9e\u73b0Firefox\u6d4f\u89c8\u5668\u4ee5\u5916\u7684\u6240\u6709\u4e3b\u6d41\u6d4f\u89c8\u5668\u7684\u6587\u5b57\u6ea2\u51fa\u70b9\u70b9\u70b9\u7701\u7565\u53f7\u663e\u793a\u3002<\/p>\n<p>\u800c\u672c\u6587\u5c06\u63d0\u4f9b\u591a\u79cd\u517c\u5bb9\u6027\u4e0a\u4f73\u7684\u6587\u5b57\u6ea2\u51fa\u70b9\u70b9\u70b9\u7701\u7565\u53f7\u663e\u793a\u7684\u65b9\u6cd5\uff0c\u800c\u91cc\u9762\u4e0d\u5c11\u65b9\u6cd5\u5c31\u662f\u81ea\u5df1\u60f3\u51fa\u6765\u7684\u3002\u6709\u4f7f\u7528\u5916\u90e8\u8f85\u52a9\u6587\u4ef6\u7684\uff0c\u6709\u7eaf\u7cb9\u7684css\u65b9\u6cd5\u7684\uff0c\u8fd8\u6709\u4f7f\u7528jQuery\u65b9\u6cd5\u7684\u3002\u6bcf\u79cd\u65b9\u6cd5\u90fd\u63d0\u4f9b\u5404\u4e2a\u6d4f\u89c8\u5668\u4e0b\u7684\u622a\u56fe\u9a8c\u8bc1\uff0c\u63d0\u4f9b\u5b9e\u4f8b\u9875\u9762\uff0c\u63d0\u4f9b\u90e8\u5206\u6e90\u6587\u4ef6\uff0c\u90fd\u662f\u503c\u5f97\u4fe1\u8d56\u7684\u65b9\u6cd5\uff0c\u5e0c\u671b\u5bf9\u60a8\u6709\u6240\u5e2e\u52a9\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[536,142,1018,143,50,966,141],"_links":{"self":[{"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/posts\/230"}],"collection":[{"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/comments?post=230"}],"version-history":[{"count":0,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/posts\/230\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/media?parent=230"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/categories?post=230"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/tags?post=230"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}