用途:Tailwind CSS 是 utility-first CSS 框架,按需生成样式,适合用类名组合方式构建界面。资料强调 v3 与 v4 存在破坏性差异,写代码前应先用 WebFetch 读取官方文档,例如 WebFetch("https://tailwindcss.com/docs"),迁移细节可再取 WebFetch("https://tailwindcss.com/blog/tailwindcss-v4")。
主要能力:v4 内置多项原需配置或插件的能力,包括 CSS 优先配置(用 @theme 指令,无需 tailwind.config.ts)、自动内容检测(无需 content 数组)、@import "tailwindcss" 内置导入、作为设计令牌的原生 CSS 变量(如 --color-、--spacing-)、内置容器查询(@min-、@max-)、内置 3D 变换(rotate-x-、rotate-y-、perspective-)、not- 变体,以及零配置 PostCSS。
用法与迁移要点:v4 无 tailwind.config.ts,定制在 CSS 中通过 @theme 完成,例如定义 --color-primary 等变量;旧的 @tailwind base/components/utilities 被单个 @import "tailwindcss" 取代;@apply 仍可用但主题化推荐 @theme;颜色透明度改用 bg-red-500/50 斜杠写法,bg-opacity-* 已移除;边框默认色改为 currentColor;部分工具类改名,如 flex-shrink-* → shrink-、flex-grow- → grow-*、overflow-ellipsis → text-ellipsis、decoration-slice → box-decoration-slice。
限制:资料未提供收费、价格、平台、效果或完整安装步骤等信息,暂未提供。