| ▲ | dsego 2 hours ago | |
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. | ||