Live data from Hacker News

Moving away from Tailwind, and learning to structure my CSS

jvns.ca

21–30 of 435 posts

Re: Moving away from Tailwind, and learning to structure my CSS

#21

> I got curious about what writing more semantic HTML would feel like. I've been teaching semantic HTML / accessible markup for a long time, and have worked extensively on sites and apps designed for screen readers. The biggest problem with Tailwind is that it inverts the order that you should be thinking about HTML and CSS. HTML is marking up the meaning of the document. You should start there. Then style with CSS.…

What's a good source to learn how to develop like this - to create HTML / CSS structure that's accessible?

EDIT: ignore. I can see you have some links in your profile. Will check it out.

Re: Moving away from Tailwind, and learning to structure my CSS

#23
post #2

Relying on React or Typscript in LLM era seems very stupid, just have the LLM setup whatever dom manipulation you want and have it write decent JS without slop. Far more offline compatible development almost negligible supply chain issues as well. At least ones you can control.

This makes no sense. LLMs and agents benefit from (good) abstraction as much as humans do.

Re: Moving away from Tailwind, and learning to structure my CSS

#24

I'm lucky to have learned the web with Angular 2.x It scopes CSS to components by default, and keeps HTML, CSS and JavaScript seperate.

Vue single-file components (SFC[0]) still works this way.

    
    
    

    
    // JS/TS as you would expect
    

    
    /* Component scoped styles here */
    
Very clean, easy to understand, and (as someone who started hand writing DHTML) it still feels very much like DHTML with more convenience and modern affordances.

[0] Vue SFC docs: https://vuejs.org/guide/scaling-up/sfc.html

Re: Moving away from Tailwind, and learning to structure my CSS

#26
post #18

Earlier quoted context omitted.

This isn't about "purity/correctness" it's about the real experience of a blind person. Accessibility means caring about the HTML. Your comment only mentions developers as the audience of HTML authoring, as opposed to users, which is a common attitude and the core problem with Tailwind.

I use Tailwind and have all kinds of "screen reader" directives in my templates. Not sure if it helps, but if we get our first blind user I will gladly make some admends to make it more usable for them. It seems that Tailwind is now blamed for the mess that is HTML/CSS. Tailwind certainly allows for accessible designs; it may not be the ideal solution, sure, but what we aim for is "good enough".

if we get our first blind user I will gladly make some admends to make it more usable for them.

Not good enough. You have to be accessible before it is needed in order to avoid legal liability.

And how do you expect to get a blind user if they already cannot use your product?

None of the doctors I build web sites for are currently blind. I know this because I talk to them regularly. But I still build the web sites for the future, when HR might hire a doctor or nurse or other person who is blind, or partially sighted, or has trouble with their muscles, or has difficulty distinguishing colors.

Doing the right thing isn't that hard. Not doing it is just lazy.

Re: Moving away from Tailwind, and learning to structure my CSS

#27
One thing that has always struck me about Tailwind is that practically every argument its proponents use more or less boils down to “I never learnt CSS beyond a junior level”. It’s super common to hear Tailwind advocates say things like “Without Tailwind, we would just have one big disorganised CSS file that always grows uncontrollably and ends up with loads of obsolete stuff in it and !important everywhere! Tailwind is so much better!”.

CSS is a skill just like any other technical skill. If all you do is learn the bare minimum so you can bodge things until you get something that looks right, then your ambitions are going to outpace your ability to keep things organised very quickly.

Re: Moving away from Tailwind, and learning to structure my CSS

#28
I have been writing a "clean" web development guide focusing on writing HTML and CSS that scales well: https://webdev.bryanhogan.com/

Maybe it's useful for people here. I don't use Tailwind or similar for styling, just CSS with modern frameworks like Astro or Svelte.

For every project I have the following CSS files:

- reset.css

- var.css

- global.css

- util.css

Other styling is scoped to that specific component or layout.

Re: Moving away from Tailwind, and learning to structure my CSS

#30
post #8

> I got curious about what writing more semantic HTML would feel like. I've been teaching semantic HTML / accessible markup for a long time, and have worked extensively on sites and apps designed for screen readers. The biggest problem with Tailwind is that it inverts the order that you should be thinking about HTML and CSS. HTML is marking up the meaning of the document. You should start there. Then style with CSS.…

While I agree I do think there's some "aspiration of purity/correctness" in your approach that I've long let go of. I look at the royal mess that is HTML/CSS/JS as a necessary evil, required when we want to target browsers. To me it's "just the presentation layer". In my work I put a lot more emphasis on correctness in the db schema, or business logic in the backend. When it comes to the messy presentation layer I pr…

[flagged]
Post reply on HN