{"id":12377996,"date":"2026-03-19T15:55:22","date_gmt":"2026-03-19T07:55:22","guid":{"rendered":"https:\/\/www.likacloud.com\/knowledge\/tailwind-css%ef%bc%9a%e4%bb%8e%e9%9b%b6%e5%bc%80%e5%a7%8b%e6%9e%84%e5%bb%ba%e7%8e%b0%e4%bb%a3%e5%93%8d%e5%ba%94%e5%bc%8f%e7%bd%91%e7%ab%99%e7%9a%84%e5%ae%8c%e6%95%b4%e6%8c%87%e5%8d%97\/"},"modified":"2026-03-19T16:13:20","modified_gmt":"2026-03-19T08:13:20","slug":"tailwind-css-complete-guide-build-modern-responsive-websites-12377996","status":"publish","type":"knowledge_post","link":"https:\/\/www.likacloud.com\/zh-hant\/knowledge\/website-building\/tailwind-css-complete-guide-build-modern-responsive-websites-12377996\/","title":{"rendered":"Tailwind CSS\uff1a\u4ece\u96f6\u5f00\u59cb\u6784\u5efa\u73b0\u4ee3\u54cd\u5e94\u5f0f\u7f51\u7ad9\u7684\u5b8c\u6574\u6307\u5357"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Tailwind CSS\uff1a\u4ece\u96f6\u5f00\u59cb\u6784\u5efa\u73b0\u4ee3\u54cd\u5e94\u5f0f\u7f51\u7ad9\u7684\u5b8c\u6574\u6307\u5357<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Tailwind CSS \u7684\u6838\u5fc3\u539f\u7406\u4e0e\u8bbe\u8ba1\u54f2\u5b66<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Tailwind CSS \u662f\u4e00\u6b3e\u529f\u80fd\u4f18\u5148\u7684 CSS \u6846\u67b6\uff0c\u5176\u6838\u5fc3\u7406\u5ff5\u662f\u76f4\u63a5\u4ece HTML \u4e2d\u6784\u5efa\u81ea\u5b9a\u4e49\u8bbe\u8ba1\u3002\u4e0e\u4f20\u7edf\u7684 Bootstrap \u8fd9\u7c7b\u63d0\u4f9b\u9884\u7f6e\u6837\u5f0f\u7ec4\u4ef6\u7684\u6846\u67b6\u4e0d\u540c\uff0cTailwind \u63d0\u4f9b\u4e86\u4e00\u7cfb\u5217\u7ec6\u7c92\u5ea6\u7684\u3001\u53ef\u7ec4\u5408\u7684\u5b9e\u7528\u7c7b\uff08Utility Classes\uff09\uff0c\u8fd9\u4e9b\u7c7b\u76f4\u63a5\u5bf9\u5e94\u5e95\u5c42\u7684 CSS \u5c5e\u6027\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u5728\u6587\u4ef6\u7684\u5165\u53e3\u5904\uff0c\u901a\u5e38\u662f <code>tailwind.config.js<\/code>\uff0c\u5f00\u53d1\u8005\u53ef\u4ee5\u5bf9\u6846\u67b6\u8fdb\u884c\u5b8c\u5168\u7684\u81ea\u5b9a\u4e49\u3002\u8fd9\u610f\u5473\u7740\u4f60\u53ef\u4ee5\u5b9a\u4e49\u81ea\u5df1\u7684\u989c\u8272\u8c03\u8272\u677f\u3001\u95f4\u8ddd\u6bd4\u4f8b\u3001\u65ad\u70b9\u548c\u5b57\u4f53\u65cf\uff0c\u4ece\u800c\u8ba9\u4f60\u7684\u8bbe\u8ba1\u7cfb\u7edf\u4e0e\u54c1\u724c\u6307\u5357\u5b8c\u7f8e\u878d\u5408\u3002\u5176\u8bbe\u8ba1\u54f2\u5b66\u662f\u201c\u7ea6\u675f\u5e26\u6765\u81ea\u7531\u201d\uff0c\u901a\u8fc7\u4e00\u5957\u7cbe\u5fc3\u8bbe\u8ba1\u7684\u3001\u539f\u5b50\u5316\u7684\u5de5\u5177\u96c6\uff0c\u5f00\u53d1\u8005\u53ef\u4ee5\u83b7\u5f97\u8fdc\u8d85\u9884\u7f6e\u7ec4\u4ef6\u7684\u7075\u6d3b\u6027\uff0c\u540c\u65f6\u53c8\u80fd\u4fdd\u6301\u89c6\u89c9\u8bbe\u8ba1\u7684\u4e00\u81f4\u6027\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u5982\u4f55\u5feb\u901f\u642d\u5efa\u7b2c\u4e00\u4e2a Tailwind \u9879\u76ee<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u542f\u52a8\u4e00\u4e2a Tailwind CSS \u9879\u76ee\u6709\u591a\u79cd\u65b9\u5f0f\uff0c\u6700\u5e38\u89c1\u7684\u662f\u901a\u8fc7\u5305\u7ba1\u7406\u5de5\u5177\u8fdb\u884c\u5b89\u88c5\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u4f7f\u7528\u5305\u7ba1\u7406\u5668\u5b89\u88c5<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u901a\u8fc7 npm \u6216 yarn \u5b89\u88c5 Tailwind CSS \u53ca\u5176\u4f9d\u8d56\u3002\u6838\u5fc3\u6d41\u7a0b\u662f\uff1a\u521d\u59cb\u5316\u9879\u76ee\u3001\u5b89\u88c5 Tailwind\u3001\u751f\u6210\u914d\u7f6e\u6587\u4ef6\u3001\u5f15\u5165\u57fa\u7840\u6837\u5f0f\u3002<\/p>\n<!-- AUTO_SYNCED_PATTERN_INSERT_START -->\n<div class=\"grid grid-cols-1 md:grid-cols-2 gap-4 md:gap-6 mb-8 md:mb-10 mt-10\"> \r\n\t<!-- \u91cd\u590d\u5668\u5faa\u73af\u5f00\u59cb -->\r\n\t\t\r\n\t<!-- \u5546\u5bb6\u5361\u7247 -->\r\n\t<div class=\"bg-white dark:bg-gray-750 rounded-lg overflow-hidden shadow-md flex gap-1 flex-col     justify-between\" data-link=\"https:\/\/www.likacloud.com\/zh-hant\/tolink\/wordpress-com-ai-website-builder\/\">\r\n\t\t<div class=\"flex items-start justify-between\"> \r\n\t\t\t<!-- \u5546\u5bb6logo -->\r\n\t\t\t<div class=\"w-16 h-16 bg-blue-200 dark:bg-blue-500\/30 flex items-center justify-center flex-shrink-0 p-3\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img decoding=\"async\" src=\"https:\/\/www.likacloud.com\/wp-content\/uploads\/2026\/01\/20260107032104.svg\" alt=\"WordPress.com \u7f51\u7ad9\u5efa\u8bbe\u52a9\u624b\" class=\"w-12 object-contain !dark-filter08\" title=\"\">\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t<\/div>\r\n\t\t\t\r\n\t\t\t<!-- \u5546\u5bb6\u4fe1\u606f -->\r\n\t\t\t<div class=\"px-4 pt-2 flex-grow\">\r\n\t\t\t\t<div class=\"flex justify-between items-start mb-2\">\r\n\t\t\t\t\t<strong class=\"text-xl font-bold\">WordPress.com \u7f51\u7ad9\u5efa\u8bbe\u52a9\u624b<\/strong>\r\n\t\t\t\t\t\t\t\t\t<\/div>\r\n\t\t\t<\/div>\r\n\t\t<\/div>\r\n\t\t\t\t<span class=\"text-gray-500 dark:text-gray-300 !text-sm p-4 pb-0\">99.999% \u53ef\u7528\u6027+\u8de8\u533a\u5bb9\u707e\uff0c\u5168\u592924\u5c0f\u65f6\u652f\u6301\uff0c\u8d2d\u4e70\u535a\u5ba2\u5957\u9910\u514d\u8d39\u4f7f\u7528AI\u6784\u5efa\u7f51\u7ad9<\/span>\r\n\t\t\t\t<div class=\"flex flex-col gap-4 md:gap-6 justify-between p-4\"> \r\n\t\t\t<!-- \u6807\u7b7e -->\r\n\t\t\t\t\t\t\r\n\t\t\t<!-- \u6d3b\u52a8\u548c\u94fe\u63a5 --> \r\n\t\t\t<div class=\"flex justify-between items-center gap-3 flex-col\">\r\n\t\t\t\t\t\t\t\t<div class=\"text-gray-500 dark:text-gray-300 !text-sm line-clamp-1\">\u514d\u8d39\u57df\u540d\u4e00\u5e74<\/div>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<a href=\"https:\/\/www.likacloud.com\/zh-hant\/tolink\/wordpress-com-ai-website-builder\/\" class=\"flex justify-end font-bold !text-lg !text-blue-600 dark:!text-blue-500\">\u8bbf\u95eeWordPress.com \u7f51\u7ad9\u5efa\u8bbe\u52a9\u624b \u2192<\/a>\r\n\t\t\t\t\t\t\t<\/div> \r\n\t\t<\/div>\r\n\t<\/div>\r\n\t\t\r\n\t<!-- \u5546\u5bb6\u5361\u7247 -->\r\n\t<div class=\"bg-white dark:bg-gray-750 rounded-lg overflow-hidden shadow-md flex gap-1 flex-col     justify-between\" data-link=\"https:\/\/www.likacloud.com\/zh-hant\/tolink\/ultahost-website-builder\/\">\r\n\t\t<div class=\"flex items-start justify-between\"> \r\n\t\t\t<!-- \u5546\u5bb6logo -->\r\n\t\t\t<div class=\"w-16 h-16 bg-blue-200 dark:bg-blue-500\/30 flex items-center justify-center flex-shrink-0 p-3\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img decoding=\"async\" src=\"https:\/\/www.likacloud.com\/wp-content\/uploads\/2025\/12\/20251227023708.webp\" alt=\"UltaHost \u7f51\u7ad9\u5efa\u8bbe\u52a9\u624b\" class=\"w-12 object-contain !dark-filter08\" title=\"\">\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t<\/div>\r\n\t\t\t\r\n\t\t\t<!-- \u5546\u5bb6\u4fe1\u606f -->\r\n\t\t\t<div class=\"px-4 pt-2 flex-grow\">\r\n\t\t\t\t<div class=\"flex justify-between items-start mb-2\">\r\n\t\t\t\t\t<strong class=\"text-xl font-bold\">UltaHost \u7f51\u7ad9\u5efa\u8bbe\u52a9\u624b<\/strong>\r\n\t\t\t\t\t\t\t\t\t<\/div>\r\n\t\t\t<\/div>\r\n\t\t<\/div>\r\n\t\t\t\t<span class=\"text-gray-500 dark:text-gray-300 !text-sm p-4 pb-0\">900+\u514d\u8d39\u3001\u53ef\u5b9a\u5236\u7684\u6a21\u677f\uff0c\u83b7\u5f97\u4f18\u5316\u7f51\u7ad9\u641c\u7d22\u66dd\u5149\u6240\u9700\u7684 SEO \u80fd\u529b<\/span>\r\n\t\t\t\t<div class=\"flex flex-col gap-4 md:gap-6 justify-between p-4\"> \r\n\t\t\t<!-- \u6807\u7b7e -->\r\n\t\t\t\t\t\t\r\n\t\t\t<!-- \u6d3b\u52a8\u548c\u94fe\u63a5 --> \r\n\t\t\t<div class=\"flex justify-between items-center gap-3 flex-col\">\r\n\t\t\t\t\t\t\t\t<div class=\"text-gray-500 dark:text-gray-300 !text-sm line-clamp-1\">\u4f18\u60e0 40%<\/div>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<a href=\"https:\/\/www.likacloud.com\/zh-hant\/tolink\/ultahost-website-builder\/\" class=\"flex justify-end font-bold !text-lg !text-blue-600 dark:!text-blue-500\">\u8bbf\u95eeUltaHost \u7f51\u7ad9\u5efa\u8bbe\u52a9\u624b \u2192<\/a>\r\n\t\t\t\t\t\t\t<\/div> \r\n\t\t<\/div>\r\n\t<\/div>\r\n\t\t<!-- \u91cd\u590d\u5668\u5faa\u73af\u7ed3\u675f -->\r\n<\/div>\r\n\r\n\r\n\n<!-- AUTO_SYNCED_PATTERN_INSERT_END -->\n\n\n\n\n\n<p class=\"wp-block-paragraph\">\u9996\u5148\uff0c\u5728\u9879\u76ee\u6839\u76ee\u5f55\u4e0b\u901a\u8fc7 <code>npm install -D tailwindcss postcss autoprefixer<\/code> \u5b89\u88c5 Tailwind CSS\u3002\u7136\u540e\uff0c\u53ef\u4ee5\u901a\u8fc7\u8fd0\u884c <code>npx tailwindcss init<\/code> \u547d\u4ee4\u6765\u751f\u6210 <code>tailwind.config.js<\/code> \u914d\u7f6e\u6587\u4ef6\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u63a5\u4e0b\u6765\uff0c\u5728\u9879\u76ee\u7684 CSS \u5165\u53e3\u6587\u4ef6\uff08\u4f8b\u5982 <code>src\/styles.css<\/code> \u6216 <code>app\/globals.css<\/code>\uff09\u4e2d\uff0c\u901a\u8fc7 <code>@tailwind<\/code> \u6307\u4ee4\u6765\u5f15\u5165\u6846\u67b6\u7684\u6838\u5fc3\u6837\u5f0f\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"language-css\">@tailwind base;\n@tailwind components;\n@tailwind utilities;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u6700\u540e\uff0c\u901a\u8fc7\u6784\u5efa\u5de5\u5177\uff08\u5982 Vite\u3001Webpack\uff09\u5904\u7406\u8fd9\u4e2a CSS \u6587\u4ef6\uff0c\u6216\u8005\u5728\u547d\u4ee4\u884c\u4e2d\u8fd0\u884c Tailwind CLI \u6765\u7f16\u8bd1\u8f93\u51fa\u6700\u7ec8\u7684 CSS\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u901a\u8fc7 CDN \u5feb\u901f\u4f53\u9a8c<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u5bf9\u4e8e\u7b80\u5355\u7684\u539f\u578b\u6216\u6f14\u793a\uff0c\u53ef\u4ee5\u901a\u8fc7 CDN \u94fe\u63a5\u5feb\u901f\u5f15\u5165 Tailwind CSS\u3002\u5728 HTML \u6587\u4ef6\u7684 <code>&lt;head&gt;<\/code> \u6807\u7b7e\u5185\u76f4\u63a5\u5f15\u5165\u5373\u53ef\uff0c\u8fd9\u79cd\u65b9\u5f0f\u65e0\u9700\u6784\u5efa\u6b65\u9aa4\u3002\u4f46\u8bf7\u6ce8\u610f\uff0cCDN \u7248\u672c\u7f3a\u5c11\u4e00\u4e9b\u9ad8\u7ea7\u529f\u80fd\uff0c\u5982\u81ea\u5b9a\u4e49\u914d\u7f6e\u3001\u6811\u6447\u4f18\u5316\uff08PurgeCSS\uff09\u7b49\uff0c\u56e0\u6b64\u4e0d\u63a8\u8350\u7528\u4e8e\u751f\u4ea7\u73af\u5883\u3002\u5176\u5f15\u5165\u65b9\u5f0f\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"language-html\">&lt;script src=&quot;https:\/\/cdn.tailwindcss.com&quot;&gt;&lt;\/script&gt;<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u54cd\u5e94\u5f0f\u8bbe\u8ba1\u4e0e\u4ea4\u4e92\u72b6\u6001\u7684\u5b9e\u7528\u7c7b<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Tailwind CSS \u5728\u54cd\u5e94\u5f0f\u8bbe\u8ba1\u548c\u5904\u7406\u4ea4\u4e92\u72b6\u6001\u65b9\u9762\u63d0\u4f9b\u4e86\u6781\u5176\u7b80\u6d01\u76f4\u89c2\u7684\u8bed\u6cd5\uff0c\u8fd9\u662f\u5176\u6838\u5fc3\u4f18\u52bf\u4e4b\u4e00\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u5b9e\u73b0\u54cd\u5e94\u5f0f\u5e03\u5c40<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Tailwind \u91c7\u7528\u79fb\u52a8\u4f18\u5148\u7684\u7b56\u7565\u3002\u8fd9\u610f\u5473\u7740\u9ed8\u8ba4\u7684\u6837\u5f0f\u7c7b\uff08\u4f8b\u5982 <code>text-sm<\/code>\uff09\u4f5c\u7528\u4e8e\u6240\u6709\u5c4f\u5e55\u5c3a\u5bf8\uff08\u5373\u79fb\u52a8\u7aef\uff09\u3002\u8981\u4e3a\u66f4\u5927\u7684\u5c4f\u5e55\u5e94\u7528\u6837\u5f0f\uff0c\u9700\u8981\u4f7f\u7528\u5bf9\u5e94\u7684\u54cd\u5e94\u5f0f\u524d\u7f00\uff0c\u5982 <code>md:<\/code>, <code>lg:<\/code>, <code>xl:<\/code>\u3002\u8fd9\u4e9b\u524d\u7f00\u76f4\u63a5\u5bf9\u5e94\u5728 <code>tailwind.config.js<\/code> \u4e2d\u914d\u7f6e\u7684\u65ad\u70b9\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4f8b\u5982\uff0c\u521b\u5efa\u4e00\u4e2a\u5728\u79fb\u52a8\u7aef\u4e3a\u7eb5\u5411\u6392\u5217\uff0c\u5728\u4e2d\u7b49\u5c4f\u5e55\u4e0a\u6a2a\u5411\u6392\u5217\u7684\u5e03\u5c40\u975e\u5e38\u7b80\u5355\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"language-html\">&lt;div class=&quot;flex flex-col md:flex-row&quot;&gt;\n  &lt;div class=&quot;p-4&quot;&gt;\u5de6\u4fa7\u5185\u5bb9&lt;\/div&gt;\n  &lt;div class=&quot;p-4&quot;&gt;\u53f3\u4fa7\u5185\u5bb9&lt;\/div&gt;\n&lt;\/div&gt;<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">\u5904\u7406\u60ac\u505c\u4e0e\u7126\u70b9\u72b6\u6001<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u5bf9\u4e8e\u4ea4\u4e92\u72b6\u6001\uff0cTailwind \u63d0\u4f9b\u4e86\u7c7b\u4f3c\u7684\u524d\u7f00\u3002\u4f8b\u5982\uff0c\u4e3a\u94fe\u63a5\u6dfb\u52a0\u60ac\u505c\u6548\u679c\u53ef\u4ee5\u4f7f\u7528 <code>hover:<\/code> \u524d\u7f00\uff0c\u4e3a\u8f93\u5165\u6846\u6dfb\u52a0\u7126\u70b9\u6837\u5f0f\u53ef\u4ee5\u4f7f\u7528 <code>focus:<\/code> \u524d\u7f00\u3002<\/p>\n<!-- AUTO_SYNCED_PATTERN_INSERT_START -->\n\n  <div class=\"flex justify-between items-center flex-col lg:flex-row xl:flex-col 2xl:flex-row gap-6 sm:gap-8 rounded-lg border border-gray-200 dark:border-gray-700 p-4 mb-8 lg:mb-10 sm:p-6 bg-white dark:bg-gray-750 shadow-md transition-colors duration-300\"\n         data-link=\"https:\/\/www.likacloud.com\/zh-hant\/tolink\/bluehost-wordpress-hosting\/\">\n\n      <div class=\"flex flex-col gap-3 gap-4 sm:gap-6 w-full\">\n        <strong class=\"text-2xl font-semibold text-gray-900 dark:text-gray-200\">Bluehost\u5efa\u7ad9\u52a9\u624b<\/strong>\n        <div class=\"text-gray-600 dark:text-gray-300 word-word\">\u63d0\u4f9b AI \u7f51\u7ad9\u521b\u5efa\u5de5\u5177\uff0c24\/7 \u5728\u7ebf\u804a\u5929\u4e0e\u7535\u8bdd\u652f\u6301\uff0c\u4e00\u5e74\u514d\u8d39\u57df\u540d\uff0c\u514d\u8d39CDN\uff0c99.99% \u6b63\u5e38\u8fd0\u884c\u65f6\u95f4 SLA<\/div>\n      <\/div>\n\n      <div class=\"flex items-center flex-col md:flex-row lg:flex-col xl:flex-row 2xl:flex-col gap-6 shrink-0\">\n                  <a href=\"https:\/\/www.likacloud.com\/zh-hant\/tolink\/bluehost-wordpress-hosting\/\">\n                          <!-- \u53ea\u6709\u4e00\u4e2a\u53ef\u7528 icon\uff08\u6216\u591c\u95f4\u56de\u9000\uff09\uff0c\u4e24\u79cd\u6a21\u5f0f\u5171\u7528 -->\n              <img decoding=\"async\" src=\"https:\/\/www.likacloud.com\/wp-content\/uploads\/2025\/12\/20251231095441.svg\" alt=\"\u5efa\u7ad9\u52a9\u624b LOGO\" class=\"content-promotion-card-icon h-9 min-h-9\" title=\"\">\n                      <\/a>\n          \n        <a href=\"https:\/\/www.likacloud.com\/zh-hant\/tolink\/bluehost-wordpress-hosting\/\"\n           class=\"bg-blue-500 w-full md:w-auto lg:w-full xl:w-auto 2xl:w-full text-center !text-white dark:!text-gray-200 !px-5 !py-1.5 rounded-full hover:bg-blue-600 transition-colors\">\n          \u8bbf\u95eeBluehost        <\/a>\n      <\/div>\n    <\/div>\n\n    \n<!-- AUTO_SYNCED_PATTERN_INSERT_END -->\n\n\n\n\n\n<pre class=\"wp-block-code\"><code class=\"language-html\">&lt;a href=&quot;#&quot; class=&quot;text-blue-500 hover:text-blue-800 hover:underline transition&quot;&gt;\u70b9\u51fb\u8fd9\u91cc&lt;\/a&gt;\n&lt;input class=&quot;border focus:border-blue-500 focus:ring-2 focus:ring-blue-200 outline-none&quot;&gt;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u8fd9\u79cd\u8bed\u6cd5\u5c06\u72b6\u6001\u6837\u5f0f\u76f4\u63a5\u4e0e\u5143\u7d20\u5173\u8054\uff0c\u65e0\u9700\u5728 CSS \u6587\u4ef6\u4e2d\u7f16\u5199\u7e41\u7410\u7684\u4f2a\u7c7b\u9009\u62e9\u5668\uff0c\u4f7f\u5f97\u4ee3\u7801\u7684\u53ef\u8bfb\u6027\u548c\u53ef\u7ef4\u62a4\u6027\u5927\u5927\u63d0\u9ad8\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u6784\u5efa\u53ef\u590d\u7528\u7684\u7ec4\u4ef6\u4e0e\u751f\u4ea7\u4f18\u5316<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u867d\u7136 Tailwind \u9f13\u52b1\u76f4\u63a5\u4f7f\u7528\u5b9e\u7528\u7c7b\uff0c\u4f46\u5b83\u4e5f\u540c\u6837\u652f\u6301\u6784\u5efa\u62bd\u8c61\u548c\u53ef\u590d\u7528\u7684 UI \u7ec4\u4ef6\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u4f7f\u7528 @apply \u6784\u9020\u7ec4\u4ef6\u7c7b<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u5f53\u4e00\u4e2a\u6309\u94ae\u6837\u5f0f\u5728\u591a\u5904\u91cd\u590d\u4f7f\u7528\u65f6\uff0c\u53ef\u4ee5\u4f7f\u7528 <code>@apply<\/code> \u6307\u4ee4\u5c06\u8fd9\u4e9b\u5b9e\u7528\u7c7b\u63d0\u53d6\u5230\u4e00\u4e2a\u81ea\u5b9a\u4e49\u7684 CSS \u7c7b\u4e2d\u3002\u8fd9\u53ef\u4ee5\u5728\u4f60\u7684 CSS \u6587\u4ef6\u4e2d\u5b8c\u6210\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"language-css\">.btn-primary {\n  @apply px-4 py-2 bg-blue-600 text-white font-semibold rounded-lg shadow-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-400 focus:ring-opacity-75 transition duration-300;\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u7136\u540e\uff0c\u5728 HTML \u4e2d\u76f4\u63a5\u4f7f\u7528 <code>class=\"btn-primary\"<\/code> \u5373\u53ef\u3002\u8fd9\u5b9e\u73b0\u4e86\u5b9e\u7528\u7c7b\u7684\u7075\u6d3b\u6027\u548c\u7ec4\u4ef6\u5316\u7684\u4fbf\u5229\u6027\u4e4b\u95f4\u7684\u5e73\u8861\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u914d\u7f6e\u6587\u4ef6\u4e0e\u751f\u4ea7\u6784\u5efa\u4f18\u5316<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u5728 <code>tailwind.config.js<\/code> \u4e2d\uff0c\u4f60\u53ef\u4ee5\u901a\u8fc7 <code>content<\/code> \u5b57\u6bb5\u6765\u914d\u7f6e\u9879\u76ee\u7684\u6a21\u677f\u6587\u4ef6\u8def\u5f84\u3002\u8fd9\u662f\u751f\u4ea7\u4f18\u5316\uff08\u201c\u6811\u6447\u201d\u6216\u201c\u6e05\u9664\u672a\u4f7f\u7528\u7684\u6837\u5f0f\u201d\uff09\u7684\u5173\u952e\u3002Tailwind \u4f1a\u5206\u6790\u8fd9\u4e9b\u6587\u4ef6\u4e2d\u51fa\u73b0\u8fc7\u7684\u6240\u6709\u7c7b\u540d\uff0c\u53ea\u5728\u6700\u7ec8\u751f\u6210\u7684 CSS \u4e2d\u4fdd\u7559\u90a3\u4e9b\u88ab\u7528\u5230\u7684\u6837\u5f0f\uff0c\u8fd9\u80fd\u6781\u5927\u5730\u51cf\u5c11 CSS \u6587\u4ef6\u4f53\u79ef\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e00\u4e2a\u5178\u578b\u7684\u914d\u7f6e\u5982\u4e0b\uff1a<\/p>\n<!-- AUTO_SYNCED_PATTERN_INSERT_START -->\n\n  <div class=\"flex justify-between items-center flex-col lg:flex-row xl:flex-col 2xl:flex-row gap-6 sm:gap-8 rounded-lg border border-gray-200 dark:border-gray-700 p-4 mb-8 lg:mb-10 sm:p-6 bg-white dark:bg-gray-750 shadow-md transition-colors duration-300\"\n         data-link=\"https:\/\/www.likacloud.com\/zh-hant\/tolink\/hosting-com-sitebuilder\/\">\n\n      <div class=\"flex flex-col gap-3 gap-4 sm:gap-6 w-full\">\n        <strong class=\"text-2xl font-semibold text-gray-900 dark:text-gray-200\">hosting.com<\/strong>\n        <div class=\"text-gray-600 dark:text-gray-300 word-word\">\u514d\u8d39SSL\u3001Cloudflare CDN\u3001WAF\uff0c40+\u5168\u7403\u673a\u623f\u53ef\u9009\uff0c\u5c31\u8fd1\u66f4\u4f4e\u5ef6\u8fdf\uff0c 24\/7\/365 \u670d\u52a1\u652f\u6301\uff0c\u73b0\u5728\u53ef\u4ee5\u7701\u4e0b\u9ad8\u8fbe 67%\u7684\u8d39\u7528\uff0c\u652f\u6301 AI \u6784\u5efa\u548c SEO \u4f18\u5316<\/div>\n      <\/div>\n\n      <div class=\"flex items-center flex-col md:flex-row lg:flex-col xl:flex-row 2xl:flex-col gap-6 shrink-0\">\n                  <a href=\"https:\/\/www.likacloud.com\/zh-hant\/tolink\/hosting-com-sitebuilder\/\">\n                          <!-- \u767d\u5929 -->\n              <img decoding=\"async\" src=\"https:\/\/www.likacloud.com\/wp-content\/uploads\/2025\/09\/20250901222940.svg\" alt=\" LOGO\" class=\"content-promotion-card-icon h-9 min-h-9 dark:hidden\" title=\"\">\n              <!-- \u591c\u95f4 -->\n              <img decoding=\"async\" src=\"https:\/\/www.likacloud.com\/wp-content\/uploads\/2025\/12\/20251228220957.webp\" alt=\" LOGO\" class=\"content-promotion-card-icon h-9 min-h-9 hidden dark:block\" title=\"\">\n                      <\/a>\n          \n        <a href=\"https:\/\/www.likacloud.com\/zh-hant\/tolink\/hosting-com-sitebuilder\/\"\n           class=\"bg-blue-500 w-full md:w-auto lg:w-full xl:w-auto 2xl:w-full text-center !text-white dark:!text-gray-200 !px-5 !py-1.5 rounded-full hover:bg-blue-600 transition-colors\">\n          \u8bbf\u95eehosting.com        <\/a>\n      <\/div>\n    <\/div>\n\n    \n<!-- AUTO_SYNCED_PATTERN_INSERT_END -->\n\n\n\n\n\n<pre class=\"wp-block-code\"><code class=\"language-javascript\">module.exports = {\n  content: [&#039;.\/src\/**\/*.{html,js,jsx,ts,tsx}&#039;],\n  theme: {\n    extend: {\n      colors: {\n        &#039;brand-blue&#039;: &#039;#1992d4&#039;,\n      }\n    },\n  },\n  plugins: [],\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u901a\u8fc7\u8fd0\u884c <code>npx tailwindcss -o build.css --minify<\/code> \u53ef\u4ee5\u751f\u6210\u4e00\u4e2a\u7ecf\u8fc7\u538b\u7f29\u7684\u3001\u53ea\u5305\u542b\u4f7f\u7528\u5230\u7684\u6837\u5f0f\u7684\u751f\u4ea7\u73af\u5883 CSS \u6587\u4ef6\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u603b\u7ed3<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Tailwind CSS \u901a\u8fc7\u5176\u72ec\u7279\u7684\u201c\u5de5\u5177\u4f18\u5148\u201d\u7406\u5ff5\uff0c\u4e3a\u524d\u7aef\u5f00\u53d1\u5e26\u6765\u4e86\u9769\u547d\u6027\u7684\u6548\u7387\u63d0\u5347\u3002\u5b83\u98a0\u8986\u4e86\u4f20\u7edf\u7684 CSS \u7f16\u5199\u65b9\u5f0f\uff0c\u5141\u8bb8\u5f00\u53d1\u8005\u76f4\u63a5\u5728 HTML \u4e2d\u8bbe\u8ba1\u590d\u6742\u3001\u54cd\u5e94\u5f0f\u4e14\u4e00\u81f4\u7684\u754c\u9762\uff0c\u5927\u5e45\u51cf\u5c11\u4e86\u5728\u6837\u5f0f\u8868\u548c HTML \u4e4b\u95f4\u6765\u56de\u5207\u6362\u7684\u4e0a\u4e0b\u6587\u6210\u672c\u3002\u5176\u9ad8\u5ea6\u53ef\u5b9a\u5236\u7684\u914d\u7f6e\u7cfb\u7edf\u786e\u4fdd\u4e86\u5b83\u53ef\u4ee5\u9002\u914d\u4efb\u4f55\u8bbe\u8ba1\u89c4\u8303\uff0c\u800c\u5185\u7f6e\u7684\u751f\u4ea7\u4f18\u5316\u529f\u80fd\u5219\u89e3\u51b3\u4e86 CSS \u6587\u4ef6\u4f53\u79ef\u81a8\u80c0\u7684\u6838\u5fc3\u75db\u70b9\u3002\u65e0\u8bba\u4f60\u662f\u72ec\u7acb\u5f00\u53d1\u8005\u8fd8\u662f\u5927\u578b\u56e2\u961f\u4e2d\u7684\u4e00\u5458\uff0c\u5b66\u4e60\u548c\u91c7\u7528 Tailwind CSS \u90fd\u5c06\u663e\u8457\u63d0\u5347\u4f60\u7684\u6837\u5f0f\u7684\u5f00\u53d1\u901f\u5ea6\u548c\u9879\u76ee\u7684\u53ef\u7ef4\u62a4\u6027\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">FAQ \u5e38\u89c1\u95ee\u9898<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Tailwind CSS \u4f1a\u5bfc\u81f4 HTML \u53d8\u5f97\u81c3\u80bf\u51cc\u4e71\u5417\uff1f<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u8fd9\u53d6\u51b3\u4e8e\u5f00\u53d1\u8005\u7684\u4f7f\u7528\u65b9\u5f0f\u3002\u867d\u7136\u76f4\u63a5\u5728 HTML \u4e2d\u7f16\u5199\u5f88\u591a\u7c7b\u540d\u53ef\u80fd\u4f1a\u5728\u4e00\u5f00\u59cb\u8ba9\u4eba\u89c9\u5f97\u5197\u957f\uff0c\u4f46 Tailwind \u7684\u5de5\u5177\u7c7b\u547d\u540d\u975e\u5e38\u89c4\u5219\u548c\u76f4\u89c2\uff0c\u53cd\u800c\u63d0\u9ad8\u4e86\u4ee3\u7801\u7684\u53ef\u8bfb\u6027\u3002\u5bf9\u4e8e\u9891\u7e41\u590d\u7528\u7684\u590d\u6742\u6837\u5f0f\uff0c\u4f60\u53ef\u4ee5\u901a\u8fc7 <code>@apply<\/code> \u6307\u4ee4\u6216 JavaScript \u7ec4\u4ef6\uff08\u5982 React\/Vue \u7ec4\u4ef6\uff09\u8fdb\u884c\u5c01\u88c5\uff0c\u4ee5\u6b64\u6765\u4fdd\u6301 HTML \u7684\u6574\u6d01\u3002\u5b9e\u8df5\u8bc1\u660e\uff0c\u8fd9\u79cd\u65b9\u5f0f\u6bd4\u5728 CSS \u6587\u4ef6\u4e2d\u7f16\u5199\u548c\u7ef4\u62a4\u5197\u957f\u7684\u9009\u62e9\u5668\u8981\u66f4\u6709\u6548\u7387\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Tailwind CSS \u4e0e Bootstrap \u7b49\u6846\u67b6\u7684\u4e3b\u8981\u533a\u522b\u662f\u4ec0\u4e48\uff1f<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u6700\u4e3b\u8981\u7684\u533a\u522b\u5728\u4e8e\u8bbe\u8ba1\u8303\u5f0f\u3002Bootstrap \u63d0\u4f9b\u4e86\u4e00\u7cfb\u5217\u9884\u5236\u7684\u3001\u6837\u5f0f\u56fa\u5b9a\u7684\u7ec4\u4ef6\uff0c\u5982\u5bfc\u822a\u680f\u3001\u5361\u7247\u3001\u6a21\u6001\u6846\u7b49\uff0c\u5f00\u53d1\u8005\u4e3b\u8981\u901a\u8fc7\u4fee\u6539 Less\/Sass \u53d8\u91cf\u6765\u5b9a\u5236\u4e3b\u9898\u3002\u800c Tailwind CSS \u5219\u4e0d\u63d0\u4f9b\u4efb\u4f55\u5177\u6709\u9884\u5b9a\u4e49\u5916\u89c2\u7684\u7ec4\u4ef6\uff0c\u5b83\u53ea\u63d0\u4f9b\u7528\u4e8e\u6784\u5efa\u4efb\u4f55\u8bbe\u8ba1\u7684\u57fa\u7840\u5de5\u5177\u96c6\uff0c\u76f8\u5f53\u4e8e\u4e00\u4e2a\u4f4e\u7ea7\u522b\u7684 CSS \u6846\u67b6\u3002\u8fd9\u7ed9\u4e86\u5f00\u53d1\u8005\u5b8c\u5168\u7684\u63a7\u5236\u6743\u548c\u8bbe\u8ba1\u81ea\u7531\uff0c\u4f46\u4e5f\u610f\u5473\u7740\u4f60\u9700\u8981\u4ece\u96f6\u5f00\u59cb\u6784\u5efa\u6240\u6709 UI \u5143\u7d20\u3002Tailwind \u662f\u4e00\u4e2a\u201cCSS-in-HTML\u201d\u7684\u6846\u67b6\uff0c\u800c Bootstrap \u662f\u201c\u7ec4\u4ef6\u9a71\u52a8\u201d\u7684\u6846\u67b6\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u5728\u5927\u578b\u9879\u76ee\u4e2d\u5982\u4f55\u7ba1\u7406 Tailwind \u7684\u914d\u7f6e\uff1f<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u5728\u5927\u578b\u9879\u76ee\u4e2d\uff0c\u4e00\u4e2a\u826f\u597d\u7ba1\u7406\u7684 <code>tailwind.config.js<\/code> \u6587\u4ef6\u81f3\u5173\u91cd\u8981\u3002\u5efa\u8bae\u5c06\u81ea\u5b9a\u4e49\u7684\u6269\u5c55\u90e8\u5206\uff08\u5c24\u5176\u662f\u989c\u8272\u3001\u5b57\u4f53\u3001\u95f4\u8ddd\u7b49\u8bbe\u8ba1\u4ee4\u724c\uff09\u6e05\u6670\u5730\u7ec4\u7ec7\u5728 <code>theme.extend<\/code> \u5bf9\u8c61\u4e0b\u3002\u53ef\u4ee5\u7ed3\u5408\u5b9e\u9645\u4f7f\u7528\u7684\u8bbe\u8ba1\u7cfb\u7edf\u6587\u6863\u6765\u547d\u540d\u8fd9\u4e9b\u53d8\u91cf\u3002\u5bf9\u4e8e\u975e\u5e38\u590d\u6742\u7684\u81ea\u5b9a\u4e49\uff0c\u53ef\u4ee5\u8003\u8651\u5c06\u914d\u7f6e\u62c6\u5206\u6210\u591a\u4e2a\u6a21\u5757\uff0c\u7136\u540e\u5728\u4e3b\u914d\u7f6e\u6587\u4ef6\u4e2d\u5bfc\u5165\u5408\u5e76\u3002\u540c\u65f6\uff0c\u5229\u7528 <code>plugins<\/code> \u5b57\u6bb5\u53ef\u4ee5\u96c6\u6210\u7b2c\u4e09\u65b9\u63d2\u4ef6\u6216\u5c01\u88c5\u81ea\u5df1\u56e2\u961f\u7684\u7279\u5b9a\u529f\u80fd\uff0c\u4ee5\u4fdd\u6301\u914d\u7f6e\u7684\u53ef\u7ef4\u62a4\u6027\u548c\u4e00\u81f4\u6027\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u5982\u4f55\u89e3\u51b3 Tailwind \u548c\u5176\u4ed6 CSS \u6846\u67b6\u6216\u6837\u5f0f\u5e93\u7684\u6837\u5f0f\u51b2\u7a81\uff1f<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u5f53 Tailwind CSS \u548c\u5176\u4ed6\u5982 Bootstrap \u8fd9\u6837\u7684 CSS \u5e93\u4e00\u540c\u4f7f\u7528\u65f6\uff0c\u6837\u5f0f\u51b2\u7a81\u53ef\u80fd\u4f1a\u53d1\u751f\uff0c\u56e0\u4e3a\u5b83\u4eec\u90fd\u4f7f\u7528 CSS \u91cd\u7f6e\uff08\u5982 normalize.css \u6216 modern-normalize\uff09\u5e76\u5b9a\u4e49\u4e86\u4e00\u4e9b\u57fa\u7840\u6837\u5f0f\u3002\u6700\u76f4\u63a5\u6709\u6548\u7684\u65b9\u6cd5\u662f\uff0c\u5b8c\u5168\u79fb\u9664\u53e6\u4e00\u4e2a\u6846\u67b6\u7684\u5168\u5c40\u6837\u5f0f\uff0c\u53ea\u4fdd\u7559\u5176 JavaScript \u4ea4\u4e92\u903b\u8f91\uff08\u5982\u679c\u6709\u7684\u5316\uff09\uff0c\u7136\u540e\u4f7f\u7528 Tailwind \u91cd\u65b0\u5b9e\u73b0\u6240\u6709\u89c6\u89c9\u5916\u89c2\u3002\u5982\u679c\u65e0\u6cd5\u5b8c\u5168\u66ff\u4ee3\uff0c\u53ef\u4ee5\u901a\u8fc7\u914d\u7f6e Tailwind \u7684 <code>corePlugins<\/code> \u9009\u9879\u6765\u7981\u7528\u67d0\u4e9b\u63d2\u4ef6\uff08\u5982\u9ed8\u8ba4\u7684\u6837\u5f0f\u91cd\u7f6e\uff09\uff0c\u4f46\u8fd9\u901a\u5e38\u4f1a\u8ba9\u96c6\u6210\u53d8\u5f97\u66f4\u52a0\u590d\u6742\u548c\u96be\u4ee5\u8c03\u8bd5\u3002\u4e00\u822c\u6765\u8bf4\uff0c\u4e0d\u5efa\u8bae\u5728\u540c\u4e00\u9879\u76ee\u4e2d\u6df7\u5408\u4f7f\u7528\u4e24\u4e2a\u529f\u80fd\u5b8c\u5907\u7684 CSS \u6846\u67b6\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u672c\u6587\u662fTailwind CSS\u7684\u5b8c\u6574\u5165\u95e8\u6307\u5357\u3002\u5b83\u4ecb\u7ecd\u4e86\u5176\u529f\u80fd\u4f18\u5148\u7684\u8bbe\u8ba1\u54f2\u5b66\uff0c\u8be6\u7ec6\u8bf4\u660e\u4e86\u901a\u8fc7\u5305\u7ba1\u7406\u5668\u6216CDN\u5feb\u901f\u642d\u5efa\u9879\u76ee\u7684\u6b65\u9aa4\uff0c\u5e76\u91cd\u70b9\u8bb2\u89e3\u4e86\u5982\u4f55\u4f7f\u7528\u5176\u54cd\u5e94\u5f0f\u524d\u7f00\u548c\u72b6\u6001\u7c7b\u6765\u6784\u5efa\u5e03\u5c40\u4e0e\u4ea4\u4e92\u3002\u6700\u540e\u63d0\u53ca\u4e86\u7ec4\u4ef6\u6784\u5efa\u4e0e\u751f\u4ea7\u4f18\u5316\u65b9\u5411\u3002<\/p>","protected":false},"author":7,"featured_media":0,"template":"","meta":{"_acf_changed":false,"footnotes":""},"tags":[],"knowledge_category":[281],"class_list":["post-12377996","knowledge_post","type-knowledge_post","status-publish","hentry","knowledge_category-website-building"],"acf":{"site_seo_keywords":"Tailwind CSS, \u54cd\u5e94\u5f0f\u7f51\u7ad9, CSS\u6846\u67b6, \u5b9e\u7528\u7c7b, \u524d\u7aef\u5f00\u53d1, \u4ece\u96f6\u5f00\u59cb\u6307\u5357, \u73b0\u4ee3\u7f51\u7ad9\u6784\u5efa"},"_links":{"self":[{"href":"https:\/\/www.likacloud.com\/zh-hant\/wp-json\/wp\/v2\/knowledge_posts\/12377996","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.likacloud.com\/zh-hant\/wp-json\/wp\/v2\/knowledge_posts"}],"about":[{"href":"https:\/\/www.likacloud.com\/zh-hant\/wp-json\/wp\/v2\/types\/knowledge_post"}],"author":[{"embeddable":true,"href":"https:\/\/www.likacloud.com\/zh-hant\/wp-json\/wp\/v2\/users\/7"}],"version-history":[{"count":0,"href":"https:\/\/www.likacloud.com\/zh-hant\/wp-json\/wp\/v2\/knowledge_posts\/12377996\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.likacloud.com\/zh-hant\/wp-json\/wp\/v2\/media?parent=12377996"}],"wp:term":[{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.likacloud.com\/zh-hant\/wp-json\/wp\/v2\/tags?post=12377996"},{"taxonomy":"knowledge_category","embeddable":true,"href":"https:\/\/www.likacloud.com\/zh-hant\/wp-json\/wp\/v2\/knowledge_category?post=12377996"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}