Live data from Hacker News

CSS is hard no matter how good you are at it

aha.io

11–20 of 83 posts

Re: CSS is hard no matter how good you are at it

#13

It's always been a time sink for me. Besides using frameworks, does anyone have any suggestions on how to develop a css file without getting into the neverending hacks that require hacks to fix the hacks? I have yet to see a long term css file that's not a birds nest of fixes.

Are you building sites or apps? I got to the point a long time ago where I just didn't care to cover every single design need and just made my own mini-framework.

Re: CSS is hard no matter how good you are at it

#14

The "trick" is to employ progressive enhancements. Also, the less CSS, the better. + no shame in using !important sometimes. All in all, CSS requires experience

!important is like global variables

Sure they have their place, but goddamnit do some people abuse them and make huge messes with them :(

Re: CSS is hard no matter how good you are at it

#15

It's always been a time sink for me. Besides using frameworks, does anyone have any suggestions on how to develop a css file without getting into the neverending hacks that require hacks to fix the hacks? I have yet to see a long term css file that's not a birds nest of fixes.

Sass helps with reusable code. Bootstrap and standards also help a bit. Bulma, PureCSS, Tailwind (Pro), Concise. These provide a good starting point.

My issue is, ever since 1997, the spec hasn’t really lent itself to composability. Just a list of definitions. Maybe some shareable effects but not idempotent in and of themselves. From tables, to floating divs, to grid 960, to flexbox. We keep inventing new ways of dealing with the shortcomings of the standard.

Inheritance and composition should be paramount. Sass and Less help but still fall short of the ideal state.

When I encounter a “this isn’t lining up” problem. I think about the composition first before I think about styling. Should I put it in a div and give that the right properties that I can then shim a span in there with the rest of the required style? Or do I need a new style definition to achieve the look. I try to avoid creating new styles if I can.

Re: CSS is hard no matter how good you are at it

#16

I've never had much trouble with CSS but I also just never try to use the cascading aspect of it outside of fonts. I just write either CSS directly onto components I'm using or I just use tailwind.

Not sure why you are getting downvote. I absolutely agree - avoid the C in CSS and your life will be much better.

Re: CSS is hard no matter how good you are at it

#20
post #6

It's always been a time sink for me. Besides using frameworks, does anyone have any suggestions on how to develop a css file without getting into the neverending hacks that require hacks to fix the hacks? I have yet to see a long term css file that's not a birds nest of fixes.

Tailwind * tries * to resolve this, but is probably just a different bird's nest.

Tailwind is a bird's nest in one place instead of a bird's nest in two places with hidden abstractions.
Post reply on HN