DEV Community

Discussion on: Why Most Developers Fear CSS

Collapse
 
steffenpedersen profile image
Steffen Pedersen

How is CSS bad designed?

Collapse
 
mikeschinkel profile image
Mike Schinkel

Lack of ability to encapsulate. Working with CSS on even a moderate sized website is like programming a large complex application in a programming language that only supports global variables. Which is bad with one developer, but far worse when there are many working on the same project.

Thread Thread
 
steffenpedersen profile image
Steffen Pedersen

You are able to encapsulate. I often use the architecture ITCSS with naming convention BEM 😃 I use it at a large company, and it's easy for other developers to wrap their head around the concepts.

Thread Thread
 
mikeschinkel profile image
Mike Schinkel

Actually, you are not able to encapsulate in CSS. What you are talking about is like the ostrich sticking its head in the sand so it cannot see its potential attackers. But its potential attackers can still see it.

The problem with "encapsulation" in CSS is it only works when everyone on the project uses it and uses it the same way. There is no way in CSS for me to write a "module" (for lack of a better word) that someone else cannot override and break with later CSS.

Yes, if you are using CSS you should absolutely employ (something like) ITCSS and BEM, but those are merely ways to reduce the pain of the symptoms of the disease, they do nothing to cure the disease itself.