Tweakimp Tweakimp - 10 months ago 50
CSS Question

How do you group similar n-th child selectors?

How can I sum these css selectors together?

td:nth-child(1), td:nth-child(4), td:nth-child(5) {
font-size: 25px;

I thought of something like

td:nth-child(1,4,5) {
font-size: 25px;

but this doesnt work. Is there a way to condense this?

Answer Source

If you can't use a an+b formula to target them (which is the case in your particular example), then the code you wrote is the shortest version.

If you wish to simplify the CSS code, you could switch to classes... that however will make your HTML less clean.