Using CSS counters, I have created various styles for an ordered list <ol>
by applying different classes and adjusting the styles accordingly.
Now, I want the counters to adjust based on screen size, displaying smaller numbers on smaller screens. To achieve this, I utilized media queries to set sizes for each of the four classes individually. While this method works effectively, it leads to redundant code. In an effort to streamline my code, I attempted to target all four classes simultaneously by:
ol.class1, ol.class2, ol.class3, ol.class4 {...}
I also experimented with:
ol > .class1, .class2, .class3, .class4 {...}
Unfortunately, in both cases, I lost the responsive behavior. It's clear that I am approaching this incorrectly. How can I efficiently target the different classes of the ordered list <ol>
at once to style them collectively?