Posted by Ancestry Team on May 7, 2013 in CSS/HTML/JavaScript

One of the key initiatives that our front-end development (FED) team has been tasked with at Ancestry.com is to help define, develop, document, implement, and enforce a global set of CSS/HTML standards for the organization. The fact that our team is in the business of creating standards (laws) and working to enforce (govern) them makes calling ourselves “the FEDs” even more appropriate.

While there are obvious high level standards and best practices defined by W3C, there are a multitude of techniques that can be used to achieve similar results when coding web pages. Those differences have been the source of some lively, heated debates (and one near fistfight) among the FEDs on our team as we’ve tried to come to a general consensus on what should be considered a site-wide global standard. Just a small sampling of the topics that have been discussed by email and argued about over cubicle walls include:

  • Single vs. multi-line CSS properties
  • Alphabetical vs. grouped declaration order
  • Spacing after brackets, commas, colons, and selectors
  • Naming conventions (camel case vs. hyphens vs. underscores)
  • Lowercase vs. uppercase
  • Tables vs. divs for tabular data
  • Etc. etc.

In an effort to resolve our differences, we turned to the most knowledgeable and complete source of information known to man … Google. After tirelessly researching and scouring endless blogs and articles to defend the use of a preferred coding style, it became increasingly apparent that for every argument in favor of a particular technique there was an equally convincing case against its use. The only thing industry experts seem to agree on is that there’s disagreement when it comes to which coding style is best. Much like selecting a preferred browser, it’s difficult to convince a Firefox user that Chrome is the better choice since they both essentially do the same thing with subtle differences.

While we’ve had to agree to disagree on several of these topics, the biggest takeaway from our research is the importance of consistency. Even WordPress has documented its own defined set of coding standards it expects contributors to follow in order to maintain consistency. When a comment was made asking why they recommended avoiding the use of underscores, the simple reply was, “Because that’s our particular style.” What we have chosen for our standards at Ancestry.com might be different from what WordPress decided to go with, but that doesn’t necessarily make us right and them wrong as long as we’re both pushing for consistency.

Long story short, being consistent is more important than whether you use camel casing instead of hyphens or choose single lines over multi-lines in your style sheets. Having a consistent coding style based on your particular preferences will generate cleaner code that’s easier to read, use, and maintain going forward.

Join the Discussion

We really do appreciate your feedback, and ask that you please be respectful to other commenters and authors. Any abusive comments may be moderated. For help with a specific problem, please contact customer service.