Tailwind 更改所有输入元素中的文本颜色

问题描述 投票:0回答:2
css tailwind-css daisyui
2个回答
0
投票

是的,当然。 在您的 global.css 文件中,您可以像这样使用默认样式:

@tailwind base;
@tailwind components;
@tailwind utilities;

    @layer base {
      h1 {
        @apply text-2xl;
      }
      h2 {
        @apply text-xl;
      }
    
      input {
       @apply text-base-content
      }
      /* ... */
    }

您可以在这里阅读更多内容: https://tailwindcss.com/docs/adding-custom-styles#using-css-and-layer


0
投票

您可以使用“@apply”将您的类附加到现有的 Tailwind 类。您可以将其添加到 CSS 文件中,如下所示:

.label {
    @apply input text-neutral-content;
}
© www.soinside.com 2019 - 2024. All rights reserved.