English 中文(简体)
我如何能够实现尾wind(0、0、0、0.54)的字句?
原标题:how can I achieve text color of rgba(0, 0, 0, 0.54) tailwind css?

how can I achieve text color of rgba(0, 0, 0, 0.54) tailwind css. I have tried text-black-500, text-current and many other variations but couldn t achieve color of rgba(0, 0, 0, 0.54).

最佳回答

Tailwind allows you to control color opacity using classes.

例:text-black/50(等到rgba(0,0,0,0.5)

在“Tailwind v3”中,有两种办法确定“代码”的字面值(0、0、0、0.54)

1. Use an arbitrary value

对于一次性价值,在您的主题文件中界定这些价值并不总是有意义的。 在这些情况下,可以更快和更容易地以武断的价值通过。

例:text-black/[54]

2. Define a custom opacity scale value of 54

在您的<代码>tailwind.config.js file 上,登记了新的不透明价值。

module.exports = {
  theme: {
    extend: {
      opacity: {
         54 :  .54 ,
      }
    }
  }
};

Usage:text-black/54

在采取这一办法时,你不妨给出一个更具描述性的名称。

问题回答

页: 1

 module.exports = {
  theme: {
    extend: {
      colors: {
         black-rgba :  rgba(0, 0, 0, 0.54) ,
      },
    },
  },
  variants: {},
  plugins: [],
}

传真:

<span class="text-black-rgba text-4xl">Hi there!</span>

与Tailwind 2做这项工作的另一个方式是使用以下类别:text-black text-opacity-50bg-black bg-opacity-50

仅使用平板彩票,如text-[rgba(0,0,0,0.8)]





相关问题
I can t use TailwindCSS in ViewComponent

Nice to meet you, I m Japanese. I want to apply TailwindCSS in Rails7 View Component, but it doesn t work. I also changed the settings in tailswind/config.js but it doesn t work. The views file has ...

Next JS Taildwind CSS navbar issue with option dropDown

I m using this navbar I created one component with navbar, the I m calling it on my src/app/page.tsx "use client"; import Login from "../app/pages/login/page"; import Dashboard ...

Tailwind background color not working as I expect

I m trying to set a background color for a div in a component, for light and dark themes, but I m not getting the result I expect. On one side, bg-gray-400 and dark:bg-gray-100 are not changing ...

Creating a background for nav sidebat

I d like to create a transparent background to go with my nav sidebar element. I was thinking of layering the div containing the sidebar on top of a div that would act as the transparent background. ...

Tailwindcs 手工艺中黑暗的风度

我需要将黑暗模式纳入我的项目。 I use NextJs v12.1.3, response 18.1.0 and tailwindcs v3.1.2. 我在官方网站上试用了这份指南,但手工挑选对我来说并不可行。 ......