css prop does not override if provided without enclosing { }
See original GitHub issueThis is a bug report. react-spinners version 0.5.3.
The css
prop is documented to override the default css, but it does not actually do this, if used like in the documentation, for example like this in my case:
const cssOverride = css`
margin: 20% auto 40%;
display: block;
`;
const loader = (
<ClipLoader
css={cssOverride}
/>
);
The display: block;
is correctly added, but in a way that it does not override the default display: inline-block
(the respective <style data-emotion="css"></style>
is added earlier in the DOM).
However, if I enclose the css string in { } inside the template literal, it does override:
const cssOverride = css`{
margin: 20% auto 40%;
display: block;
}`;
This seems to be the way the default styles are written as well. I’m not experienced with emotion-js, so I cannot explain why that makes the object precedence work as intended, but it seems that’s how it works.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:17 (8 by maintainers)
Top Results From Across the Web
Overriding properties in CSS - Stack Overflow
I would like the first span 's width to be 190px, and second's to be 10px. But both are 190px: why it's not...
Read more >How to Override CSS Styles - W3docs
An ID selector only takes precedence over a Class selector if they are both used in the same element. Let's now see how...
Read more >Overriding CSS properties of third-party components in Angular
You can override a third-party component's CSS properties either at an enclosing component or global level. Unless you want to affect all the ......
Read more >will-change - CSS: Cascading Style Sheets - MDN Web Docs
Indicates that the author expects to animate or change the property with the given name on the element in the near future. If...
Read more >Styled Components - Emotion
The as prop is only used by styled when it's not forwarded to the underlying element. By default, this means that the as...
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 FreeTop 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
Top GitHub Comments
This is still an issue for me.
This issue still persists in 0.6.1