{"id":2561,"date":"2024-11-10T09:48:12","date_gmt":"2024-11-10T01:48:12","guid":{"rendered":"https:\/\/fwq.ai\/blog\/2561\/"},"modified":"2024-11-10T09:48:12","modified_gmt":"2024-11-10T01:48:12","slug":"css-%e5%a4%9a%e8%a1%8c%e7%9c%81%e7%95%a5%e5%8f%b7%e4%b8%ba%e4%bb%80%e4%b9%88%e4%b8%8d%e7%94%9f%e6%95%88%ef%bc%9f%e5%a6%82%e4%bd%95%e8%a7%a3%e5%86%b3%e8%8b%b1%e6%96%87%e5%92%8c%e4%b8%ad%e6%96%87","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/2561\/","title":{"rendered":"CSS \u591a\u884c\u7701\u7565\u53f7\u4e3a\u4ec0\u4e48\u4e0d\u751f\u6548\uff1f\u5982\u4f55\u89e3\u51b3\u82f1\u6587\u548c\u4e2d\u6587\u5185\u5bb9\u7684\u7701\u7565\u95ee\u9898\uff1f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/173079648495287.jpg\" class=\"aligncenter\" title=\"CSS \u591a\u884c\u7701\u7565\u53f7\u4e3a\u4ec0\u4e48\u4e0d\u751f\u6548\uff1f\u5982\u4f55\u89e3\u51b3\u82f1\u6587\u548c\u4e2d\u6587\u5185\u5bb9\u7684\u7701\u7565\u95ee\u9898\uff1f\u63d2\u56fe\" alt=\"CSS \u591a\u884c\u7701\u7565\u53f7\u4e3a\u4ec0\u4e48\u4e0d\u751f\u6548\uff1f\u5982\u4f55\u89e3\u51b3\u82f1\u6587\u548c\u4e2d\u6587\u5185\u5bb9\u7684\u7701\u7565\u95ee\u9898\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong> \u4e2d\u591a\u884c\u7701\u7565\u53f7\u4e0d\u751f\u6548\u7684\u89e3\u51b3\u65b9\u6848<\/strong><\/p>\n<p>\u5728 css \u4e2d\u4f7f\u7528 text-: ellipsis \u901a\u5e38\u53ef\u4ee5\u5b9e\u73b0\u591a\u884c\u6587\u5b57\u7684\u7701\u7565\u663e\u793a\u3002\u4f46\u662f\uff0c\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u6b64\u5c5e\u6027\u53ef\u80fd\u4e0d\u4f1a\u751f\u6548\u3002<\/p>\n<p><strong>\u82f1\u6587\u5185\u5bb9\u65e0\u6548<\/strong><\/p>\n<p>\u5f53\u591a\u884c\u6587\u5b57\u5305\u542b\u82f1\u6587\u65f6\uff0c\u7701\u7565\u53f7\u53ef\u80fd\u65e0\u6cd5\u751f\u6548\u3002\u8fd9\u662f\u56e0\u4e3a\u82f1\u6587\u5355\u8bcd\u901a\u5e38\u4e0d\u5305\u542b\u7a7a\u683c\u5206\u9694\u7b26\u3002\u6d4f\u89c8\u5668\u4f1a\u5c06\u6240\u6709\u5b57\u7b26\u89c6\u4e3a\u4e00\u4e2a\u5355\u8bcd\uff0c\u5bfc\u81f4\u65e0\u6cd5\u8bc6\u522b\u5355\u8bcd\u8fb9\u754c\u5e76\u8fdb\u884c\u7701\u7565\u3002<\/p>\n<p><span>\u7acb\u5373\u5b66\u4e60<\/span>\u201c\u201d\uff1b<\/p>\n<pre>.item {\n  width: 100px;\n  overflow: hidden;\n  text-overflow: ellipsis;\n  display: -webkit-box;\n  -webkit-box-orient: vertical;\n  -webkit-line-clamp: 3;\n}\n\n&lt;div class=\"item\"&gt;\n  abcdefghijhlmnljjasufoqwhfesadhfjasdflasdjfalsfjla;skdnfvkasldjlsafpwqeuriwehfklsdahvjsahdf\n&lt;\/div&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u89e3\u51b3\u65b9\u6848<\/strong><\/p>\n<p>\u8981\u89e3\u51b3\u6b64\u95ee\u9898\uff0c\u53ef\u4ee5\u91c7\u7528\u4ee5\u4e0b\u65b9\u6cd5\uff1a<\/p>\n<ul>\n<li> <strong>\u6dfb\u52a0 word-break: break-all; \u6837\u5f0f\uff1a<\/strong>\u6b64\u6837\u5f0f\u5c06\u5f3a\u5236\u6d4f\u89c8\u5668\u62c6\u5206\u5355\u8bcd\uff0c\u5373\u4f7f\u6ca1\u6709\u7a7a\u683c\u3002<\/li>\n<\/ul>\n<pre>.item {\n  word-break: break-all;\n  \/* \u5176\u4f59\u6837\u5f0f\u540c\u4e0a *\/\n}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<ul>\n<li> <strong>\u5728\u5185\u5bb9\u4e2d\u6dfb\u52a0\u7a7a\u683c\uff1a<\/strong>\u5728\u82f1\u6587\u5355\u8bcd\u4e4b\u95f4\u6dfb\u52a0\u7a7a\u683c\u5206\u9694\u7b26\u4e5f\u80fd\u89e3\u51b3\u95ee\u9898\u3002<\/li>\n<\/ul>\n<pre>&lt;div class=\"item\"&gt;\n  abcdefghijhlmnljjasufoqwhfesadhfjasdf lasdjfalsfjla; skdnfvkasldjlsafpwqeuriwehfklsdahvjsahdf\n&lt;\/div&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u4e2d\u6587\u5185\u5bb9\u6709\u6548<\/strong><\/p>\n<p>\u5f53\u591a\u884c\u6587\u5b57\u5305\u542b\u4e2d\u6587\u65f6\uff0c\u7701\u7565\u53f7\u901a\u5e38\u4f1a\u6b63\u5e38\u751f\u6548\u3002\u8fd9\u662f\u56e0\u4e3a\u4e2d\u6587\u4e0d\u4f7f\u7528\u7a7a\u683c\u5206\u9694\u8bcd\u8bed\uff0c\u6d4f\u89c8\u5668\u53ef\u4ee5\u81ea\u52a8\u8bc6\u522b\u5b57\u7b26\u8fb9\u754c\u3002<\/p>\n<pre>.item {\n  width: 100px;\n  overflow: hidden;\n  text-overflow: ellipsis;\n  display: -webkit-box;\n  -webkit-box-orient: vertical;\n  -webkit-line-clamp: 3;\n}\n\n&lt;div class=\"item\"&gt;\n  \u54c8\u54c8\u54c8\u54c8\u54c8\u54c8\u54c8\u54c8\u54c8\u54c8\u54c8\u54c8\u54c8\u54c8\u54c8\u7ea2\u7ea2\u706b\u706b\u604d\u604d\u60da\u60da\n&lt;\/div&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4ee5\u4e0a\u5c31\u662fCSS \u591a\u884c\u7701\u7565\u53f7\u4e3a\u4ec0\u4e48\u4e0d\u751f\u6548\uff1f\u5982\u4f55\u89e3\u51b3\u82f1\u6587\u548c\u4e2d\u6587\u5185\u5bb9\u7684\u7701\u7565\u95ee\u9898\uff1f\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e2d\u591a\u884c\u7701\u7565\u53f7\u4e0d\u751f\u6548\u7684\u89e3\u51b3\u65b9\u6848 \u5728 css \u4e2d\u4f7f\u7528 text-: ellipsis \u901a\u5e38\u53ef\u4ee5\u5b9e\u73b0\u591a\u884c\u6587\u5b57\u7684\u7701\u7565\u663e\u793a\u3002\u4f46\u662f\uff0c\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u6b64\u5c5e\u6027\u53ef\u80fd\u4e0d\u4f1a\u751f\u6548\u3002 \u82f1\u6587\u5185\u5bb9\u65e0\u6548 \u5f53\u591a\u884c\u6587\u5b57\u5305\u542b\u82f1\u6587\u65f6\uff0c\u7701\u7565\u53f7\u53ef\u80fd\u65e0\u6cd5\u751f\u6548\u3002\u8fd9\u662f\u56e0\u4e3a\u82f1\u6587\u5355\u8bcd\u901a\u5e38\u4e0d\u5305\u542b\u7a7a\u683c\u5206\u9694\u7b26\u3002\u6d4f\u89c8\u5668\u4f1a\u5c06\u6240\u6709\u5b57\u7b26\u89c6\u4e3a\u4e00\u4e2a\u5355\u8bcd\uff0c\u5bfc\u81f4\u65e0\u6cd5\u8bc6\u522b\u5355\u8bcd\u8fb9\u754c\u5e76\u8fdb\u884c\u7701\u7565\u3002 \u7acb\u5373\u5b66\u4e60\u201c\u201d\uff1b .item { width: 100px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; } &lt;div class=&#8221;item&#8221;&gt; abcdefghijhlmnljjasufoqwhfesadhfjasdflasdjfalsfjla;skdnfvkasldjlsafpwqeuriwehfklsdahvjsahdf &lt;\/div&gt; \u767b\u5f55\u540e\u590d\u5236 \u89e3\u51b3\u65b9\u6848 \u8981\u89e3\u51b3\u6b64\u95ee\u9898\uff0c\u53ef\u4ee5\u91c7\u7528\u4ee5\u4e0b\u65b9\u6cd5\uff1a \u6dfb\u52a0 word-break: break-all; \u6837\u5f0f\uff1a\u6b64\u6837\u5f0f\u5c06\u5f3a\u5236\u6d4f\u89c8\u5668\u62c6\u5206\u5355\u8bcd\uff0c\u5373\u4f7f\u6ca1\u6709\u7a7a\u683c\u3002 .item { word-break: break-all; \/* \u5176\u4f59\u6837\u5f0f\u540c\u4e0a *\/ } \u767b\u5f55\u540e\u590d\u5236 \u5728\u5185\u5bb9\u4e2d\u6dfb\u52a0\u7a7a\u683c\uff1a\u5728\u82f1\u6587\u5355\u8bcd\u4e4b\u95f4\u6dfb\u52a0\u7a7a\u683c\u5206\u9694\u7b26\u4e5f\u80fd\u89e3\u51b3\u95ee\u9898\u3002 &lt;div class=&#8221;item&#8221;&gt; abcdefghijhlmnljjasufoqwhfesadhfjasdf lasdjfalsfjla; skdnfvkasldjlsafpwqeuriwehfklsdahvjsahdf &lt;\/div&gt; \u767b\u5f55\u540e\u590d\u5236 \u4e2d\u6587\u5185\u5bb9\u6709\u6548 \u5f53\u591a\u884c\u6587\u5b57\u5305\u542b\u4e2d\u6587\u65f6\uff0c\u7701\u7565\u53f7\u901a\u5e38\u4f1a\u6b63\u5e38\u751f\u6548\u3002\u8fd9\u662f\u56e0\u4e3a\u4e2d\u6587\u4e0d\u4f7f\u7528\u7a7a\u683c\u5206\u9694\u8bcd\u8bed\uff0c\u6d4f\u89c8\u5668\u53ef\u4ee5\u81ea\u52a8\u8bc6\u522b\u5b57\u7b26\u8fb9\u754c\u3002 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-2561","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/2561","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=2561"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/2561\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=2561"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=2561"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=2561"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}