Post History:

Animals Matter to Me

Refactoring applies to CSS too

I came across this today:

.purple { color: #000181; }

For reference, this is what “purple” is defined as:


CSS has been around long enough that hopefully it is obvious that this a terrible name for a class. That wasn’t enough to make me write about it. Even worse than the bad naming, is needing to change pages that use this class without changing the name to something sensible. Failing to do so will lead to what I found elsewhere. Purple had been redefined as:

.purple {
  color: #4B7C80;

which looks like:


Refactoring can should apply to CSS too. If you find a badly named class, it might seem to easier to just keep using it, but it only gets more confusing as time goes on.

To help make the point, I’ll leave you to ponder this:

.big_purple {
  font-size: 18px;
  font-weight: bold;


Adding new comments is currently disabled.