3 ms·
This actually has a semantic purpose, it's not just about bike shedding. CSS classes, if applied to the same element, will prefer the class that's defined later
by andkenneth 3y ago
This actually has a semantic purpose, it's not just about bike shedding. CSS classes, if applied to the same element, will prefer the class that's defined later in the CSS file. The plugin sorts them via priority order so it's more clear is one tag might override another.
- aidos 3y agoInteresting idea. I’ve seen people get very confused by thinking that adding them in a certain order to the element would give some sort of control. Which order do they do it in? Later classes are later in the css so more likely to be applied?
- dumbo-octopus 3y agoYes, the specificity/precedence is all determined statically from only the .css files, the class order has nothing to do with it. This is a good thing because it allows for methods like https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList/add https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenLis... to not need to concern themselves with insert positions. https://developer.mozilla.org/en-US/docs/Web/CSS/Specificity https://developer.mozilla.org/en-US/docs/Web/CSS/Specificity > If the competing selectors have the same values in all the three columns, the proximity rule comes into play, wherein the last declared style gets precedence.
- aidos 3y agoSorry, I meant what order does this is linter do it in? I’m well aware of how css works, I’ve been here since we did table layouts with shims!
- dumbo-octopus 3y agoThe order of the classes in the dom will match the order of the classes in the .css files