Live data from Hacker News

Ask HN: Is it just me, or is CSS too damn hard?

news.ycombinator.com

21–30 of 358 posts

Re: Ask HN: Is it just me, or is CSS too damn hard?

#21

It's not just you. I'd recommend using a CSS framework. Have you checked out Bootstrap [0]? I was very much the same way (focused on backend). CSS is just a means to an end for me, in that I just wanted something that doesn't look like total garbage, so I used Bootstrap for the frontend bits. Allows you to quickly get up and running using the examples without learning too much CSS [1]. Just find something that looks…

Don't use bootstrap for anything beyond personal project prototypes. It ends up being a complete nightmare for maintenance. Coupling of DOM with presentation and state is the number one thing we should be avoiding in modern JS apps.

Interesting, I'll have to read about that. This has totally not been my experience.

Re: Ask HN: Is it just me, or is CSS too damn hard?

#22
> I can't center my divs properly.

This is actually pretty simple, once you understand how "block" elements work. Block elements will always try to fill up the "available width" i.e., they stretch side ways. The sum of margin + its width must match the total width.

Inline elements will fill up its parent block like text.

So, a simple example - suppose you set a div's width to 100px, and margin to auto, then you will a 100px wide box centered.

I see people get confused when they try to have a block that has an unspecified width and hope CSS just figures out.

Re: Ask HN: Is it just me, or is CSS too damn hard?

#23
CSS is crazy.

To keep my sanity, I try to avoid touching it as much as I can (I use Semantic-UI which gets me most elements with little effort), and when I have to, I try to stick to the more recent, reasonable parts. Flexbox for example is understandable and predictable.

Re: Ask HN: Is it just me, or is CSS too damn hard?

#24

I think there is a spectrum Of skills with programming at one extreme and visual design at the other. Even within “front end” you tend to have JS experts and CSS/design/UX experts. Some people can do both. When you consider UX, accessibility, progressive enhancement, cross browser and cross device support - there’s plenty to know. And unlike programming, it doesn’t all flow logically. Some stuff is subjective, other…

I don't see get why anyone thinks that CSS skills and design/UX skills somehow go together. It seems to me that the skills needed to write CSS have more in common with those needed for programming than for UI design.

Re: Ask HN: Is it just me, or is CSS too damn hard?

#25

The thing with CSS is it's not a programming language. Progamming skills and CSS skills are almost completely orthogonal. It is simply a domain of practical knowledge that takes years and years of dealing with all the idiosyncracies, cross browser issues, and silly warts of historical legacy that come with it to master. That being said, it is without a doubt the most powerful and simplest layout tool in existence. Th…

> There's very very good reasons why practically all software nowadays has gone to HTML/CSS based UIs.

One being that practically all software nowadays are webapps and there's no choice. For those that aren't webapps and whose GUI toolkit use CSS or something like CSS, it's probably to try to pull people that already have experience with webapps.

Re: Ask HN: Is it just me, or is CSS too damn hard?

#26

Earlier quoted context omitted.

Don't use bootstrap for anything beyond personal project prototypes. It ends up being a complete nightmare for maintenance. Coupling of DOM with presentation and state is the number one thing we should be avoiding in modern JS apps.

Interesting, I'll have to read about that. This has totally not been my experience.

It works great... for a while. Then you end up wanting to tweak something here and there, start adding classes to things, and you realize you want to do something that requires changes to the DOM within a component and you're screwed. Or you ignore the fact that the right way would be modifying the DOM, use some hacky CSS to kludge it, and you start getting browser inconsistencies. Either way you end up stuck with 100k of dependencies to style a popover and a dropdown that could have just been defined in a design system from the get-go and done with minimal CSS in a React/Vue type architecture scoped to the individual component.

Re: Ask HN: Is it just me, or is CSS too damn hard?

#27
post #11

I actually prefer coding CSS from scratch. Color schemes and making things look nice IS hard, for my previous and current projects I had to get feedback from friends, family, end users, graphic designers, etc. UX is hard, it's a different field than programming, but there is a method, research, and science behind it. Here's a good resource for UX: https://goodui.org And here is one for color theory: https://uxplanet.…

I also really enjoy building CSS UIs from scratch, but editing existing stylesheets is a pain point. Band-aid after band-aid.

I think keeping UI components tiny and coupling the stylesheets with the component is the best way I've seen (not necessarily styled components, just styles in the same folder as the component.)

As the component is removed, its easy to nuke the stylesheet with surgically removing related styles and not breaking something else.

Re: Ask HN: Is it just me, or is CSS too damn hard?

#29
I remember when I first told my colleagues that I followed every single CSS course on Lynda, they laughed. They thought why would you spend all this time on a non programming language?

No one takes CSS seriously. For most, CSS comes as an after thought. Build every part of the application then suddenly "Oh Right! CSS!" Slap bootstrap or other popular framework then don't think about it.

Yes, CSS is not a programming language like others but it is just as complex. It requires studying, practice and long exposure to become versed in it.

Note: you can google your way into using a couple jquery functions, but you can't become a competent JavaScript developer like that. The same goes for CSS.

Re: Ask HN: Is it just me, or is CSS too damn hard?

#30
I've written a small but non-trivial amount of CSS for my website recently, and my general perspective has been that CSS has quite a few non-obvious corner cases (margin collapsing, the exact semantics of how things will wrap or overflow) and I really haven't quite understood why certain solutions work and when some don't (when they seem to do the same thing?), and I'm not sure if it's because the model is just too complex or these are idioms that I should memorize.
Post reply on HN