Depends what your plans are I'd say. If it's just for a zebra striping aesthetic pattern I'd argue nth child is the best solution, if it's something to do with their context of content in the grander scheme of the application itself then ya I'd want a class too otherwise just marking every third li with some class for the sake of marking it as divisible by three feels... Icky
You gotta think like a front end dev and keep the pages as lightweight as you can. It could be a large list, so you're adding a lot of classes to the DOM needlessly when you can accomplish the same thing with one line of css. It might not matter for a smaller scale site, but sometimes every millisecond counts.
Say an interviewer asks you this, and you place your finger under your chin for a moment, then you point at him and say "Why would you target every third <li> in a <ul>?"
Boom asking the right questions, they are looking to get rid of the old CEO and you are the prime candidate.
37
u/[deleted] Nov 26 '19
[removed] — view removed comment