ClassName override by other class !important
See original GitHub issueThe css classes are not ordert correct, have to override everything with important
<div role="region" class="MuiAccordion-region">
<div class="MuiAccordionDetails-root makeStyles-details-11 css-15v22id-MuiAccordionDetails-root">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo lobortis eget.
</div>
</div>
so i have to add everywhere !important to override the style it looks like its your own style logic
Issue Analytics
- State:
- Created 2 years ago
- Comments:9 (1 by maintainers)
Top Results From Across the Web
How to override the properties of a CSS class using another ...
You should override by increasing Specificity of your styling. There are different ways of increasing the Specificity. Usage of !important ...
Read more >How to override the CSS properties of a class using another ...
To override the CSS properties of a class using another class, we can use the !important directive. In CSS, !important means “this is ......
Read more >How to Override CSS Styles - W3docs
When an important rule is used on a style declaration, this declaration will override any other declarations. When two conflicting declarations with the...
Read more >How to Override One CSS Class with Another - Netguru
Here's how to do it: Firstly, check which class overrides it. Let's say your markup returns: <div class="range-specific range"> ...
Read more >How to override CSS style from another style
Id Overrides Class. A class selector is re-usable. In other words, multiple elements can have the same class name and so the same...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Yea that is exactly what I was saying @Mansi1. By definition of Cascading Style Sheets, the more specificity a rule has the more priority it gets. If rules have the same specificity, then it is whichever rule is farthest down the file.
In order to use JSS before emotion, you need to use
StyledEngineProvider
and use the propinjectFirst
.StyledEngineProvider
is used to help migrate from v4 to v5. Please be aware that JSS will be replaced in favor of emotion so the first solution I gave should be the preferred solution in future projects.Ok so I’ve came up with a solution to solve this issue if it is using MUI v5. MUI v5 is moving away from JSS to the
styled
andsx
API. That said, I believe thatmakeStyles
anduseStyles
should be removed and replaced with something else. I have a CodeSandbox as an example solution based on this assumption. Also, I added background colors to better visualize what styles effect which components.https://codesandbox.io/s/classname-override-by-other-class-important-28848-fwxj0