instead of this:
#1 span.error { color: #fff; }
#2 span.error { color: #fff; }
Is it better/quicker to use:
#1 span.error, #2 span.error { color: #fff; }
Is there a way to shorten even more?
I am accepting Ana’s answer, but for me agam360 hit the target first.
Thank you all
Yes, I believe it is better – you avoid redundancy and if you have this situation multiple times, it can significantly reduce the size of your CSS.
Even shorter would be to add the same class to the two ids. Something like:
and then you can write:
If you don’t have any
span.errorelements outside the elements having ids#1and#2, then you could compact this further to justspan.error { color: #fff; }If, in addition to this, the elements having class
.errorare always<span>elements, them it cam become.error { color: #fff; }So how much you can compact things really depends on your HTML structure.