DEV Community

Discussion on: How do you organize your CSS?

Collapse
 
polyov_dev profile image
Evan Derby

For blocks which receive unique styling, I try to use class names to create a pattern for what belongs to what: .navigation-button -> .navigation-button-text, .navigation-button-icon, etc. This means that those unique styles won't cascade unexpectedly down into other elements later.

However, for components which will certainly be reused, I try to use BEM when possible. Not every button will be a button.sign-in, so I continue to try and scope my styles using css.

If I need something super consistent I'll just try and find a library like Bootstrap, which has already made those decisions for me.