4 ms·
> Write the HTML agnostic to how it's intended to appear, and then just use CSS as a tool to style the already existing document. But it's not possible to writ
by prmph 2y ago
> Write the HTML agnostic to how it's intended to appear, and then just use CSS as a tool to style the already existing document.
But it's not possible to write HTML agnostic to how it's intended to appear, in the general sense. That's the issue with CSS. This whole thing about separating content and styling is carried too far leading to very bad UI architectures.
Stuff like colors and fonts can be separated from content. Stuff like positioning, hierarchy, etc. cannot be meaningfully separated from content in many cases, and trying to do so is the root of UI evil.
This is why the component approach is so powerful. By combining content (with its implied style) with explicit styling in an integrated package, large UI trees become composable and easier to reason about.
But many devs still don't grasp this, and continue to fantasize about pure content that can exist totally separate from presentation, a pipe dream.
- emmacharp 2y agoYou can use structural HTML and CSS inside components as their content is already structured and should not change on whim. Same for the first "master" layout layer. Applying styles with "form" classes like card still is semantic too!