【问题标题】:Tailwind css apply on new class does not workTailwind css 适用于新课程不起作用
【发布时间】:2021-11-27 17:31:17
【问题描述】:

我正在尝试在 tailwind-CSS 配置中添加新颜色。

并在课堂内使用新颜色作为背景。

但我得到了错误:

// index.scss
// Here I am trying to apply green-100 as a background color
.focus-unanswered-question {
  @apply: bg-green-100;
  transition: background-color 1s ease;
}

由于这段代码,我收到下一条错误消息:

错误:需要一个伪类或伪元素。


    // tailwind.config.js
    module.exports = {
      theme: {
        },
        colors: {
          transparent: 'transparent',
          black: '#000',
          white: '#FFF',
          status: {
            yellow: '#ffbf29',
            red: '#cc2a18',
          },
          green: {
            100: '#fbfcfc',
          },
    }

【问题讨论】:

标签: html css tailwind-css


【解决方案1】:

在@apply之后删除:

.focus-unanswered-question {
  @apply bg-green-100;
  transition: background-color 1s ease;
}

【讨论】:

    猜你喜欢
    • 2021-04-04
    • 2021-09-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-02-14
    • 2022-01-20
    • 2022-10-22
    • 2021-03-25
    相关资源
    最近更新 更多