【发布时间】:2021-09-02 08:12:00
【问题描述】:
如何在 TailWind CSS 中使用颜色?
我正在学习 TailWind CSS。我在 Laravel 中使用 TailWind CSS。
我的tailwind.config.js 如下所示
const { colors } = require('tailwindcss/defaultTheme')
module.exports = {
purge: [],
darkMode: false, // or 'media' or 'class'
theme: {
colors: {
cadetblue:'#5f9ea0',
},
extend: {},
},
variants: {
extend: {},
},
plugins: [],
}
我在<head></head> 中声明的 CSS 如下所示。
<style>
.hello { background-color: theme('colors.cadetblue'); }
</style>
我在 HTML 中使用.hello 类,如下所示。
<div class="hello">Hello</div>
但这不起作用。
【问题讨论】:
标签: tailwind-css