| ▲ | weinzierl 3 hours ago | |
CSS was born out of the idea that content and presentation should be separate with the former controlled by the author and the latter by the consumer. Most of CSS's design was informed by that idea. That styling is in separate files in the first place and then all the complicated cascading stuff that is even in the name of the thing. I've always been fond of that idea and still am but there is no denial that it utterly and completely failed and now we live in a world where all these things are just cargo cult. Sometimes I think it'd be best to finish what Tailwind started and be consequential about it which would mean going back to presential HTML alltogether. | ||
| ▲ | dsego an hour ago | parent [-] | |
It failed because it married selectors to the content, so the CSS rules inevitably follow the document structure. You can avoid it by either using utility css, avoiding descendant selectors or using some methodology like BEM and use only classes to style elements. There are two types of separation here, same document that can be styled differently with a different stylesheet (think zen garden), but the other one is reusing the same look&feel across different web pages. These two goals are not always compatible. The other thing to consider is that maybe HTML itself is the presentation layer, data usually lives in a database or different file formats, JSON, CSV, excel spreadsheets. A lot of the aspects of laying out the content is trapped in how you structure the HTML, and no amount of CSS can change how the document is organized. | ||