如何在 Tailwind CSS 中使用具有任意值的 类
How in Tailwind CSS to use classes with arbitrary values
我是 Tailwind CSS 的新手。通过 link https://tailwindcss.com/docs/just-in-time-mode#arbitrary-value-support 我看到我们可以使用 类 和任意值,例如
class="bg-[#1da1f1]"
但是浏览器看不到包含 [
、]
、#
等字符的 类。
那么如何使用它们或如何在 Tailwind 中使用它们?我不明白
[
、]
、#
等字符在 css 选择器中被转义。
参考 -
像这样-
.bg-\[\#333\] {
--tw-bg-opacity: 1;
background-color: rgba(51, 51, 51, var(--tw-bg-opacity));
}
我是 Tailwind CSS 的新手。通过 link https://tailwindcss.com/docs/just-in-time-mode#arbitrary-value-support 我看到我们可以使用 类 和任意值,例如
class="bg-[#1da1f1]"
但是浏览器看不到包含 [
、]
、#
等字符的 类。
那么如何使用它们或如何在 Tailwind 中使用它们?我不明白
[
、]
、#
等字符在 css 选择器中被转义。
参考 -
像这样-
.bg-\[\#333\] {
--tw-bg-opacity: 1;
background-color: rgba(51, 51, 51, var(--tw-bg-opacity));
}