Google uses cookies to serve non-personalized adds on this page. You can read more here.

A few simple CSS guidelines

posted on 2013-01-14

I worked on a project where we started off with Bootstrap, but later had to mix in more different styles from different sources. Because none of us where real CSS guru's, the decision was made to get somebody with CSS knowledge on the team.

Eventually, when we got that CSS guy on the team, he was greeted with a rare mix of Bootstrap and project specific additions. A few times during the stand-up I asked him if he could come up with some lessons we should take from the terrible CSS we created.

Because he was very busy, he was forced to mention a few guidelines only. Here are the guidelines I could still remember today:

  • Never style on id.
  • Split up classes for positioning and for look.
  • Make sure you do not have to nest selectors. Even if SASS makes that very easy.
  • If you have to use anything like !important, you made a mistake somewhere.

If you know of any other guidelines, please consider adding them in the comments.