Using the style attribute doesn't apply all styles
See original GitHub issueI was pretty confused for a while about why variants such as focus:
only work in certain places. Specifically, I was trying to use style={tw`focus:some-property`}
and it refused to work until I changed my approach and used tw.button`focus:some-property`
. I didn’t find this info in the docs, so I was hoping you could add it to the README or something. I only realized after reading Issue #80
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Why is my CSS style not being applied? - Stack Overflow
I had custom styling applied only on some elements (rows of table). I use Bootstrap. This was caused ...
Read more >Dynamic style - manipulating CSS with JavaScript - W3C Wiki
The style object has attributes that correspond to the different CSS properties we set. For example, style.color returns the colour that element has...
Read more >Specificity - CSS: Cascading Style Sheets - MDN Web Docs
Specificity is the algorithm used by browsers to determine the CSS declaration that is the most relevant to an element, which in turn, ......
Read more >CSS Class Selectors: How to Use to Style an HTML Element
Moreover, you can avoid repeating the same code for each HTML element that uses the same styling. Hence, the amount of CSS code...
Read more >How to Troubleshoot CSS Not Working - WPForms
Here's a tutorial that'll walk you through all of the main steps to ... If clearing your browser cache doesn't seem to work,...
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
Yeah all good - I totally understand how this could be confusing, especially if only some of the styles are seemingly working with the style tag. I’m considering going heavy-handed on this by popping an error if tw is used directly on the style tag.
From v1.10.0, twin will now pop an error when you try to use
tw
within a style prop 🎉