简体   繁体   中英

(S)CSS React element selector

I'm looking for a simple way to select an existing react element in my css. I've tried searching it but only found confusing answers about tons of libraries I can use, and none seemed to fit what I'm trying to do.

I want to have a regular .scss file, where if I have the react element called Foo , I can do something like this:

Foo {
    color: red;
}

This would be great because I could continue with .scss files which I like, and could select components. How can I do this (or achieve similar behaviour)?

Notice that I'm not the one creating the element so I can't just apply a class to all of them.

您可以轻松地做到这一点,方法是添加className = Foo并在Sass中通过(.Foo)进行调用,并使用编译器程序将Sass转换为CSS,例如(Prepros),然后将CSS文件作为指向主HTML文件的链接进行调用

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM