I don't see how replacing uses of classes with selection by id is an improvement - it achieves the same result, but now that "class" can only be used in one place - might as well have used inline styles if css classes are "so bad". Also, you now can't make partial styles, or styles that are only _slightly_ different, eg
textarea {
color: red;
}
textarea.disabled {
color: gray;
}
Aiming for full semantic html and applying styles at the tag level _is_ good, but this seems like a not-very-useful refactor which has only made the code more rigid /2c
I don't see how replacing uses of classes with selection by id is an improvement - it achieves the same result, but now that "class" can only be used in one place - might as well have used inline styles if css classes are "so bad". Also, you now can't make partial styles, or styles that are only _slightly_ different, eg
textarea { color: red; }
textarea.disabled { color: gray; }
Aiming for full semantic html and applying styles at the tag level _is_ good, but this seems like a not-very-useful refactor which has only made the code more rigid /2c
I get along without classes just fine, if I have an edge case I usually don't need a class but rather need to target an attribute or pseudo class.
If a textarea is disabled there's no need to add a class.
textarea {background:red;} textarea[disabled] {background:gray;}
Could also be generalized as: [disabled] {background:gray;} or forms specifically: [disabled]:is(textarea, input, select, button) {background:gray;}