By no means should this article serve as the bible of CSS & JS coding standards, though it should get the ball rolling for those who are unsure where to start. Over the years, I’ve had the privilege of working with many talented developers, each of whom have left little bits and pieces of their coding style behind. From those pieces I’ve assembled this article.
Let’s begin…
Alphabetize Your Code
Alphabetizing your code is an extra organizational step often overlooked. It’s especially helpful in PHP classes containing getter and setter functions, but it also comes in handy for CSS and JS. Often times similarly named elements will be somewhat related in function, so clustering them together makes them easier to find.
I’d recommend alphabetizing everything from JS class and function names, to CSS classes and ID’s. You’ll notice that every code example in this article is alphabetized to further exemplify the point.
