3 ms·
Interesting article that summarizes quite well the criticism aimed at CSS you come across periodically on the web. The way CSS is written amongst the web devel
by bbx 13y ago
Interesting article that summarizes quite well the criticism aimed at CSS you come across periodically on the web.
The way CSS is written amongst the web developers and designers depends on whether you have easy access to the HTML or not.
If I work on a Tumblr or WordPress theme, I can strip down my HTML structure to the minimal and work my way around with context selectors (for example having global styles for my .post-title, and add specific adjustments for #sidebar .post-title or #single .post-title).
But if I need to send HTML/CSS templates to a client's developers, I will need to turn my components into reusable and independent objects (like in a Bootstrap file), that will carry their style while being moved around to prevent them from being altered by the context in which they end up. I would also increase the density of my HTML to cover for all the possible cases, and give the developers some flexibility.
As a front-end developer only working on HTML and CSS, keeping content and style completely seperate is the goal I aim for everytime I start a new project. But maintaining such a division is hard when working with developers because they generally don't touch the CSS at all. So I need to provide styling directly into the HTML because that's what developers generate and have their hands on. I don't blame the working process for making me write a different kind of CSS. It's just how it has to be done. Neither type of CSS is better than the other: they are just suited for 2 different situations.
And that's why I don't believe there is a perfect way to write CSS. There are useful tricks and smart shortcuts but, although having been a dedicated front-ender for 4 years with no programming skills, I don't think CSS is meant to be discussed too thoroughly.