htmlcssbemoocss

CSS methodology: OOCSS vs. BEM


Which one should I use, OOCSS or BEM, when you want to write clean CSS? Is there any reason that you may prefer to use one over the another?


Solution

  • At the end of the day you should know what your particular use case is and learn what works for you. Obviously if you're working for a company and they prefer one over the other you wanna go with that! My team and I wrote out our own internal CSS namespace specifications which are based off of BEM. The reason we prefer BEM is largely because of how extremely self-documenting it can be. I can look at a class name and know everything about that class's element.

    However, there's no right or wrong answer. As long as your code is self documented, clean, and easily maintainable. Use whatever standard you want.