{"id":26072,"date":"2024-11-24T08:07:44","date_gmt":"2024-11-24T00:07:44","guid":{"rendered":"https:\/\/fwq.ai\/blog\/26072\/"},"modified":"2024-11-24T08:07:44","modified_gmt":"2024-11-24T00:07:44","slug":"tailwind-css-%e4%b8%ad%e7%9a%84-line-height-leading-%e5%a4%b1%e6%95%88%e4%ba%86%ef%bc%9f%e5%a6%82%e4%bd%95%e8%ae%a9%e5%85%83%e7%b4%a0%e5%9e%82%e7%9b%b4%e5%b1%85%e4%b8%ad%ef%bc%9f-2","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/26072\/","title":{"rendered":"Tailwind CSS \u4e2d\u7684 line-height (leading) \u5931\u6548\u4e86\uff1f\u5982\u4f55\u8ba9\u5143\u7d20\u5782\u76f4\u5c45\u4e2d\uff1f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/173078840560169.jpg\" class=\"aligncenter\" title=\"Tailwind CSS \u4e2d\u7684 line-height (leading) \u5931\u6548\u4e86\uff1f\u5982\u4f55\u8ba9\u5143\u7d20\u5782\u76f4\u5c45\u4e2d\uff1f\u63d2\u56fe\" alt=\"Tailwind CSS \u4e2d\u7684 line-height (leading) \u5931\u6548\u4e86\uff1f\u5982\u4f55\u8ba9\u5143\u7d20\u5782\u76f4\u5c45\u4e2d\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>tlwind \u4e2d\u7684 line-height\uff08leading\uff09\u5931\u6548\u4e86\uff1f<\/strong><\/p>\n<p>\u5728\u4f7f\u7528 Tailwind CSS \u65f6\uff0c\u53d1\u73b0 line-height\uff08leading\uff09\u6837\u5f0f\u65e0\u6548\uff0c\u5bfc\u81f4\u5143\u7d20\u65e0\u6cd5\u3002\u4e0b\u9762\u4ee5\u793a\u4f8b\u4ee3\u7801\u4e3a\u4f8b\uff0c\u8fdb\u884c\u95ee\u9898\u5206\u6790\u548c\u89e3\u51b3\uff1a<\/p>\n<pre>&lt;nav class=\"w-full nav h-12\"&gt;\n    &lt;div class=\"container mx-auto flex\"&gt;\n        &lt;div class=\"w-24 leading-6 text-center h-12 hover:bg-black\"&gt;\u9996\u9875&lt;\/div&gt;\n        &lt;p class=\"w-24 leading-6 text-center h-12 hover:bg-black\"&gt;\u9996\u9875&lt;\/p&gt;\n        &lt;span class=\"w-24 leading-6 text-center h-12 hover:bg-black\"&gt;\u9996\u9875&lt;\/span&gt;\n    &lt;\/div&gt;\n&lt;\/nav&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u95ee\u9898\u539f\u56e0\uff1a<\/p>\n<p>line-height \u7684\u5b9e\u9645\u503c\u662f line-height: 1.5rem\uff0c\u800c h-12 \u7684\u5b9e\u9645\u503c\u662f height: 3rem\u3002\u56e0\u6b64\uff0cline-height \u5b9e\u9645\u4e0a\u53ea\u5360\u9ad8\u5ea6\u7684\u4e00\u534a\uff0c\u5bfc\u81f4\u5143\u7d20\u65e0\u6cd5\u5c45\u4e2d\u3002<\/p>\n<p>\u6b64\u5916\uff0cTailwind CSS \u7684 leading \u503c\u6700\u5927\u4e0d\u8d85\u8fc7 leading-10\uff0c\u56e0\u6b64\u6ca1\u6709 leading-12 \u7684\u503c\u3002<\/p>\n<p><span>\u7acb\u5373\u5b66\u4e60<\/span>\u201c\u201d\uff1b<\/p>\n<p>\u89e3\u51b3\u529e\u6cd5\uff1a<\/p>\n<p><strong>\u4f7f\u7528\u5782\u76f4\u5c45\u4e2d\u5b9e\u7528\u7a0b\u5e8f\uff1a<\/strong><\/p>\n<p>\u5728\u5143\u7d20\u4e2d\u4f7f\u7528 items-center \u548c justify-center \u5b9e\u7528\u7a0b\u5e8f\uff0c\u5c06\u5143\u7d20\u5782\u76f4\u548c\u6c34\u5e73\u5c45\u4e2d\u3002<\/p>\n<pre>&lt;div class=\"flex h-12 w-24 items-center justify-center hover:bg-black hover:text-white\"&gt;\u9996\u9875&lt;\/div&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u8c03\u6574\u9ad8\u5ea6\u503c\uff1a<\/strong><\/p>\n<p>\u5c06 h-12 \u8c03\u6574\u4e3a h-10\uff0c\u8ba9\u5143\u7d20\u7684\u9ad8\u5ea6\u4e0e leading-10 \u76f8\u5339\u914d\u3002<\/p>\n<pre>&lt;div class=\"h-10 w-24 text-center leading-10 hover:bg-black hover:text-white\"&gt;\u9996\u9875&lt;\/div&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u81ea\u5b9a\u4e49 leading \u503c\uff1a<\/strong><\/p>\n<p>\u521b\u5efa\u4e00\u4e2a\u81ea\u5b9a\u4e49\u7c7b\uff0c\u4f8b\u5982 .leading-12\uff0c\u5e76\u5c06 line-height \u8bbe\u7f6e\u4e3a 2.5rem\u3002<\/p>\n<pre>.leading-12 {\n  line-height: 2.5rem;\n}\n\n&lt;div class=\"w-24 leading-12 text-center h-12 hover:bg-black hover:text-white\"&gt;\u9996\u9875&lt;\/div&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4ee5\u4e0a\u5c31\u662fTlwind CSS \u4e2d\u7684 line-height (leading) \u5931\u6548\u4e86\uff1f\u5982\u4f55\u8ba9\u5143\u7d20\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>tlwind \u4e2d\u7684 line-height\uff08leading\uff09\u5931\u6548\u4e86\uff1f \u5728\u4f7f\u7528 Tailwind CSS \u65f6\uff0c\u53d1\u73b0 line-height\uff08leading\uff09\u6837\u5f0f\u65e0\u6548\uff0c\u5bfc\u81f4\u5143\u7d20\u65e0\u6cd5\u3002\u4e0b\u9762\u4ee5\u793a\u4f8b\u4ee3\u7801\u4e3a\u4f8b\uff0c\u8fdb\u884c\u95ee\u9898\u5206\u6790\u548c\u89e3\u51b3\uff1a &lt;nav class=&#8221;w-full nav h-12&#8243;&gt; &lt;div class=&#8221;container mx-auto flex&#8221;&gt; &lt;div class=&#8221;w-24 leading-6 text-center h-12 hover:bg-black&#8221;&gt;\u9996\u9875&lt;\/div&gt; &lt;p class=&#8221;w-24 leading-6 text-center h-12 hover:bg-black&#8221;&gt;\u9996\u9875&lt;\/p&gt; &lt;span class=&#8221;w-24 leading-6 text-center h-12 hover:bg-black&#8221;&gt;\u9996\u9875&lt;\/span&gt; &lt;\/div&gt; &lt;\/nav&gt; \u767b\u5f55\u540e\u590d\u5236 \u95ee\u9898\u539f\u56e0\uff1a line-height \u7684\u5b9e\u9645\u503c\u662f line-height: 1.5rem\uff0c\u800c h-12 \u7684\u5b9e\u9645\u503c\u662f height: 3rem\u3002\u56e0\u6b64\uff0cline-height \u5b9e\u9645\u4e0a\u53ea\u5360\u9ad8\u5ea6\u7684\u4e00\u534a\uff0c\u5bfc\u81f4\u5143\u7d20\u65e0\u6cd5\u5c45\u4e2d\u3002 \u6b64\u5916\uff0cTailwind CSS \u7684 leading \u503c\u6700\u5927\u4e0d\u8d85\u8fc7 leading-10\uff0c\u56e0\u6b64\u6ca1\u6709 leading-12 \u7684\u503c\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-26072","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/26072","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=26072"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/26072\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=26072"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=26072"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=26072"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}