-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix CSS specificity #1456
Comments
I found that using p {
color: rebeccapurple;
}
@layer type {
.box p {
font-weight: bold;
font-size: 1.3em;
color: green;
}
} and the text will be purple, and not green - since layers come first. Looking at the spec, it also seems like we can fix this with a one-liner, by updating our import statements:
We will probably still have to do this for every component, since people can use single files. This means our @import url('./react-css-modules.css') layer;
@import url('./alert.css') layer; |
After reading though an article from css tricks, I suggest we use nested layers: @layer fds.button { ... } This makes sure everything is under a layer named |
As we discovered during fix for #1448 we found out that some of our css has to high specificity due to combination of selectors. We should aim our css to have no higher specificity than
0,1,0
because thats what passedclassName
normally have.The text was updated successfully, but these errors were encountered: