People in the first camp tend to like Vue, CSS/Sass, Htmx, server rendering, etc.
People in the second camp like React and React Native, CSS-in-JS, Tailwind, etc.
And I like to be an expert in HTML+CSS (at least I try), and still prefer JSX to e.g. Vue's template syntax.
prototype (or throwaway code you don't care about)? JS and tailwind something you have to maintain? TS and external stylesheet
It doesn't though unless you're mostly dealing with traditional documents.
Most non-trivial styling requires you to edit the HTML as well because CSS alone isn't powerful enough e.g.
- you need to add tags to content you want to style only for presentation reasons
- to layout/align content it's often much easier or the only choice to reorganise the HTML
- lots of CSS problems require you to add extra tags because the styling you want to do cannot be done or isn't possible with a single tag.
I know about the Zen Garden demo, but this approach hasn't panned out in practice. Every website redesign I've ever seen involved large changes to the HTML, and it's not from lack of developer skill.
This only works for trivial stuff. Presentation is more than just colors, fonts and margins. Layout is deeply intertwined with the structure your HTML, attempts at mitigating this have made a monumental mess of CSS. The sooner you recognize it as the pipe dream that it is, the more time you will have to work on your actual goal.
I also feel the opposite about what the user perceives. The user perceives the result of applying all your CSS rules - which is closer to inline styles everywhere rather than separating things out.
Can you elaborate on this? Do you mean that the separation through external stylesheets creates a more cohesive UI for the user?
The HTML has its say on layout part, so the presentation is not exclusively on the CSS. Also, the core part of defining the whole UI is usually delegated to some global CSS rules, usually known as the theme in CSS-in-JS libraries. I don't think having external stylesheet helps that much.
When I was starting out with HTML, inline styles were considered to be a hack, and the goal of writing good HTML was to separate the data from the presentation as completely as possible. It seems that nowadays people place more emphasis on encapsulation rather than separation, they want their style to live with the component. Separation and encapsulation are in opposition: vertical vs horizontal architecture of code.
Personally I prefer separation. While components are a good way to divide up functionality, when it comes to presentation users are perceiving the UI of your entire website, not the individual UIs of each component. Separating the style into a stylesheet gives you global control over presentation and makes you more aligned with how the user is perceiving things.