DEV Community

Salvietta150x40
Salvietta150x40

Posted on • Originally published at ma-no.org

Introduction to Bem (Block Element Modifier)

I think I might not be the only one with this experience: after finally grasping all the important concepts regarding CSS I wanted to start giving what I thought would be beautiful yet simple style to my HTML code. But suddenly I ended up with class names such as “blue” “bigger” “text_normal”. “text_normal2” and similar. I stumbled directly into this CSS pitfall, which seems to be caused by a lack of structure and rules to follow when writing CSS. This kind of code is dangerous and hard to maintain because you might forget what class name does what and to which HTML element it can be applied, and so on. Chaos reigns.

So what possible solutions to this problem are there? You could come up with your own “home-made” CSS-naming set of rules to keep your code manageable but this would mean only you would be able to read the code fast and your team members would have to try and decipher your rule set. Not to say if everyone in the team made up their own CSS naming convention. Why not try an option that has been around some time know and therefor is tried and tested?

Read all

AWS Security LIVE!

Join us for AWS Security LIVE!

Discover the future of cloud security. Tune in live for trends, tips, and solutions from AWS and AWS Partners.

Learn More

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay