Use nth-child(6n)
and nth-child(7n)
const container = document.getElementById('container');
for (let i = 1; i <= 300; i++) {
const elm = document.createElement('div');
elm.innerText = i;
container.append(elm);
}
#container div:nth-child(6n), #container div:nth-child(7n) {
color: red;
}
<div id="container"></div>
solved Styling loop element in for in javascript