Hacker News new | ask | show | jobs
by Kiro 4845 days ago
This is actually a great argument. I'm almost convinced. However, in the second example, wouldn't it be better to just have a .scrollbar-frame > .button with all the styles and then just do class="button up" and class="button down"?
1 comments

Yes, but this enables it to be reused in other contexts, where the names "up" and "down" would not make much sense, but you would like to have the same border style for some reason.

Plus, you could turn this into a mixin "function", with the actual colors of the states changed depending on where you include it.

So the way he writes it, you could have a green, blue, whatever version of those borders, with the same one line (plus a parameter), whereas in CSS you would have to do:

up-blue, up-red, up-green, down-blue, down-red, down-green etc classes.