小编Tor*_*ore的帖子

TailwindCSS 使用带有占位符颜色的 @apply

我试图@apply在 TailwindCSS 中与占位符颜色一起使用,但由于某种原因,尽管我能够@apply与其他属性一起使用,但它似乎不起作用。我还可以将占位符颜色选项用作 CSS 类。它只是不适用于@apply.

@tailwind base;

input {
  @apply placeholder-gray-900;
}

@tailwind components;

@tailwind utilities;
Run Code Online (Sandbox Code Playgroud)

通过尝试这个,我最终遇到了这个错误:

`@apply` cannot be used with `.placeholder-gray-900` because `.placeholder-gray-900` either cannot be found, or its actual definition includes a pseudo-selector like :hover, :active, etc. If you're sure that `.placeholder-gray-900` exists, make sure that any `@import` statements are being properly processed *before* Tailwind CSS sees your CSS, as `@apply` can only be used for classes in the same CSS …
Run Code Online (Sandbox Code Playgroud)

tailwind-css

7
推荐指数
1
解决办法
2926
查看次数

标签 统计

tailwind-css ×1