2 ms·
The decoupling of CSS and HTML is a lie. HTML describes layout, not just content. Your overall structure is going to be vastly different whether you use flex
by dgb23 3y ago
The decoupling of CSS and HTML is a lie.
HTML describes layout, not just content.
Your overall structure is going to be vastly different whether you use flex or grid. And if you don’t want to write overly clever CSS you’re wrapping your dt/dd pairs in divs or you put dummy elements into your sections to control where the anchor links scroll to etc. And don’t get me started on non-hierarchical layout relationships.
HTML is not flexible enough and CSS is not expressive enough for this theoretical separation to hold in practice. You would need a translation layer between pure content and layout for this to be true (like XSLT).
- fjfuvucucuc 3y agoI never suggested decoupling html and CSS, that is always going to be coupled through selectors. What I suggested was decoupling presentation (actual CSS rules) from structure, the blocks of html. What I'm discussing here is if CSS rules should be inlined in html, whether through tailwind pseudo css or style tags the result is the same. Further caveat, the article mentions that switching to a CSS file is a context switch. Put it in a style tags next to your html for all I care, colocation is great as a general rule, inlining CSS in html style attributes is not. This is settled thinking at this point: inlining CSS results in short term benefits to productivity at the cost of long term costs due to brittle presentation that is expensive to change. And given how low the cost of extracting reusable css classes is these days, I don't think tailwind will ever win.