English 中文(简体)
Tailwind CSS中哪一个优先事项、习惯用途类别或原子类别?
原标题:Which has a higher priority, custom utility classes or atomic classes in Tailwind CSS?

I defined a custom class in tailwind.config.js, such as:

module.exports = {
    theme: {
        extend: {
            fontSize: {
                 regular-12 : [
                     12px ,
                    {
                        lineHeight:  20px ,
                        fontWeight:  400 ,
                    },
                ],
            }

        },
    },
};

and then use in html:

class="font-bold text-regular-12"

最后的<代码>font-chlorinat>/code>boldnormal?

目前,<代码>font-chlorinat>/code>被定在<代码>bold上。

最佳回答

在创建的CSS中,扩大的类别.text-term-12列在类别前。

这两个班级具有相同的特性,因此决定因素是其在中央支助事务档案中的顺序。 以后出现的班级将优先于先前确定的班级。

因此,由于这一命令,案文最终将具有大胆的权重。

你们可以在此例产出中看到这一点:https://play.tailwindcs.com/uPHbxiHakY?file=cs

If you want your custom class to override the font-weight you can define it in the css file like so:

@layer utilities {
  .text-regular-12 {
    @apply text-xs/5 font-normal;
  }
}

Demo: https://play.tailwindcss.com/N9PwsW1I75?file=cs

问题回答

暂无回答




相关问题
Web application utility class

The following is a utility class that is called by a LoginBean to add and get a User object from a session through FacesContext. The application uses Spring. Should I use an annotation or is it an ...

Question on Utility Application - iPhone SDK

I have this application I made on a utility based app. How would I incorporate this app into a view based application so I can run the code from there.. Like 2 seperate projects in one. I basically ...

WAV file splitter utility

I have a PROGRAMMING task (homework) to investigate brute force neural net methods. That part of the problem is MY homework. We have to show that certain simple words repeated in a verbal conversion ...

Java: Static Class?

I have a class full of utility functions. Instantiating an instance of it makes no semantic sense, but I still want to call its methods. What is the best way to deal with this? Static class? Abstract?