Least Bytes, but How Much More Specific?
It seems to me for selectors, in most cases you cannot get any shorter than two characters plus the space, especially if we are talking about a "global" use of adding specificity (which seems to be the case since you were using html
). So to save on CSS, you need a single character id on the html
. I would say an id (and not a class), as you would want to keep it unique. So you implement like so in the html:
<html id="A">
Which then allows for the shortest possible selector addition in the CSS of:
#A .whateverYour [OriginalSelector] string .was {}
Then using what James Donnelly stated (which, by the way, I never knew about the repetition of the same selector), you could continually add more and more specificity with the least amount of characters like so:
#A#A#A .whateverYour [OriginalSelector] string .was {}
Disclaimer
By answering as I have, I am not recommending this is necessarily a good way to do CSS, nor a good way to handle specificity issues. But I do believe that adding the short one character id to the html
element is the least amount of bytes one could use to increase specificity of any selector, which answers the question here.
html
? Are the styles being overwritten? Why not just include that stylesheet after the others if they're using the same selector – SmokeyPHP Oct 16 '13 at 9:24html
can be improved upon – wheresrhys Oct 16 '13 at 9:33