【问题标题】:How do I get @apply to work in TailwindCSS?如何让 @apply 在 TailwindCSS 中工作?
【发布时间】:2020-04-12 11:34:00
【问题描述】:

我似乎无法让 TailwindCSS @apply 工作。 Visual Studio Code 似乎无法识别我的代码。

.btn {
  @apply mb-2 bg-purple-600 text-gray-100 font-bold p-3 rounded;
}

【问题讨论】:

    标签: css tailwind-css


    【解决方案1】:

    您在应用命令“.”中定义的没有顺风类名称。你不需要放它。

    作为一种解决方案,将所有顺风元素写在一行中。

    .btn {
      @apply mb-2 bg-purple-600 text-gray-100 font-bold p-3 rounded;
    }
    

    【讨论】:

      【解决方案2】:

      全部写在一行中:

      .btn {
        @apply mb-2 bg-purple-600 text-gray-100 font-bold p-3 rounded;
      }
      

      希望对你有帮助。

      【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-08-31
      • 2021-07-18
      • 2014-05-14
      • 2022-06-17
      • 1970-01-01
      • 2021-04-20
      • 2020-03-13
      • 2022-01-14
      相关资源
      最近更新 更多