You've probably coded up something like that, right? How many times? A lot? Did you do it from scratch each time?
I think more discussion about front end code reusability is worth having. Theoretically I would think CSS would be some of the most reusable code we have available, but that doesn't seem to be true in practice.
I have more thoughts, but I'll save them for the comment thread.