There are no regex in CSS (thank god!)
But your code, well… it begs a bunch of questions:
are they recieving unique values or not?
why put the active/inactive on the ID, that’s what CLASSES are for!
if the majority of them would be getting the same class and have a perfectly good ID or class on a element wrapping them, like your DIV, what do they need a class OR ID for?
I would also use the old programming rule of not using terms similar to existing values like pseudostates – “active” is a pseudostate and as such too easily confused, which is why I prefer “current”
Basically, it feels like your code is suffering from a nasty case of “not every ejaculation deserves a name”
ID is for unique values, TAG is for common values, classes are for different values that may occur more than once.
So long as you use a ID or class to change the common ones you could… You can either inherit off the parent element’s ID or class, or target it directly.
I often have five or six different paragraph stylings – as a rule I set the like things about P using just P, the things unique to a section using whatever is on that section’s DIV (.newsPost P, .sideBar P} and then should one or two of them be unique, then put a class on them.
By the book you can put as many classes on as many elements as you like – the key is to just make sure you don’t overdo it when you don’t have to.
Most important rule of all – the less code you use, the less there is to break. A lesson lost on many modern developers… (Just look at all the endless Javascript for NOTHING people are ruining perfectly good websites with)
– edit –
oh, and in your second code, that’s why you use CLASS instead of ID on those. ID’s are unique, can only be used once. ALSO an element is only supposed to have ONE ID.
Personally I’d not use an id for “current”, I’d use a class - but that’s because I might have another element on the page I might want to call ‘current’ – that’s where inheriting off the parent comes into play.