在 TailwindCSS bg-white 颜色输出中!重要的 css 标志和悬停:!bg-white 不起作用

问题描述 投票:0回答:1

我正在使用 TailwindCSS,但遇到了一些问题:

  • bg-white 默认输出背景颜色:“#fff !important”。

  • hover:!bg-white 被忽略。悬停:bg-white 效果很好。

我尝试在 tailwind.config.js 中进行设置:

  theme: {
    colors: {
      white: "#ffffff",
    },
  }
reactjs tailwind-css
1个回答
0
投票

问题很可能是

hover:!bg-white
不起作用,因为顺风不支持
!important

为了确保它有效,您可以尝试这样做:

module.exports = {
  important: true,
  theme: {
    colors: {
      white: "#ffffff",
    },
  },
};

© www.soinside.com 2019 - 2024. All rights reserved.