BUG: Using _odd does not work like CSS nth-child(odd)
See original GitHub issue🐛 Bug report
When I used
_odd
and instead ofnth-child(odd)
CSS selector, I’ve seen unexpected behaviours in the UI.
💥 Steps to reproduce
- Go to http://github.com/ogzhanolguncu/ogzhanolguncu.com/blob/master/components/TimeLineItem.tsx and clone this repo
- Find line number 22 and try adding
_odd={{ left: "auto", right:"5px" }}
By adding_odd
, you will override existing CSS and break the solution.
🧐 Expected behaviour
_odd does not behave like an
nth-child(odd)
🧭 Possible Solution
Not compulsory, but suggesting a fix would be great!
🌍 System information
Software | Version(s) |
---|---|
Chakra UI | v1 |
Browser | Chrome |
Operating System | Windows |
📝 Additional information
When CSS is used that’s the outcome:
With _odd
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
nth-child(odd) not working as expected - Stack Overflow
You should be setting ClientTableRow class, like so: .ClientTableRow:nth-child(odd) {background-color:#FF0000;}.
Read more >Forums - CSS - :nth-child/nth-of-type bug - CSS-Tricks
Right, but my problem is that the list item is there and needs to be there. There will be elements in the list...
Read more >A :nth-child(An+B [of S]?) polyfill thanks to CSS :has() and :not()
This selector is mostly used to select the odd or even elements from a group of siblings, or to alternate the style of...
Read more >Odd & Even :nth-child Selectors not working - SitePoint
Hey Gang, I've got a peculiar problem. I'm using :nth-child(odd) and :nth-child(even) selectors on some div's with the class "tour-box".
Read more >How can I style every other row in a dynamic table? - Litmus
I am using this CSS code to target evert odd <tr> element (see img ... the inliner doesn't like (odd) so could try...
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
okay now applying the nth-of-type selector to all the children of the right-side-bar and this seems to be working for me. This is for anyone struggling to find a css solution.
<Box className=“right-side-bar” … > … </Box>
I don’t have an answer to your question about SSR unfortunately, but I wanted to thank you for following up with a solution @nihalanisumit. Much appreciated that you’d think of others that might come later with a similar problem.