I'm adding an element in front of an H2 tag using the before pseudocode. I want a different color for the 2nd, 3rd, and 4th, so I've tried this code to no avail:
.containerClass h2:before { //this part works and the content is output
/* container content goes here, this is just an example */
background-color: blue;
}
.containerClass h2:nth-of-type(2):before {
background-color: var(--warning); //should change the color of what is output but does not
}
I've also tried ...h2:before:nth-of-type(2) and neither changes the background color. Am I using the wrong selector or do :nth-of-type and :before not combine
if it matters, the actual structure is:
div.containerClass
section
h2