JSFiddle - React, Tailwind, and code Playground
HTML
<div id="one"></div>
<div id="two" style="display:none"></div>
<div id="three"></div>
CSS
div {
width: 50px;
height: 50px;
background:blue;
}
div:nth-child(odd) {
background: yellow;
}
div:nth-child(even) {
background: red;
}
JavaScript
console.log('querySelectorAll: ', document.querySelectorAll('div:nth-child(odd)') );