【问题标题】:Is it possible to combine talwind daisyUI with CSS variables?是否可以将 talwind daisyUI 与 CSS 变量结合使用?
【发布时间】:2021-11-15 09:29:10
【问题描述】:

是否可以将 tailwind daisyUI 与 CSS 变量结合使用?像这样?使用 DaisyUI

:root { --primary-color:#570df8; }

如何使用这样的东西?这不起作用,

  themes: [
      {
        mytheme: {
          primary: "var(--primary-color)", //not working
          "primary-focus": "#4506cb",
          "primary-content": "#ffffff",
          secondary: "#f000b8",
          "secondary-focus": "#bd0091",
          "secondary-content": "#ffffff",
        },
      },
    ],```

【问题讨论】:

    标签: javascript css reactjs tailwind-css


    【解决方案1】:

    你应该输入:

    :root { --primary-color:#570df8; }
    

    在主样式文件中的 @tailwind 指令之后。

    【讨论】:

    • 嘿,看上面我以我的风格添加了它,这适用于 taiwind:module.exports = { theme: { extend: { colors: { "primary-color": "var(--primary-color)", "secondary-color": "var(--secondary-color)" }, }, }, }; 但它不适用于 Tailwind,就像我添加的示例一样
    猜你喜欢
    • 2011-02-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-06-07
    • 2015-01-02
    • 2019-02-15
    • 2020-09-17
    • 2019-11-06
    相关资源
    最近更新 更多