Live data from Hacker News

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

news.ycombinator.com

41–50 of 358 posts

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

#41
> Is CSS an "art" thing?

Certainly![0]

> Is it common for other developers to have issues with it?

Boy howdy it is! Like eight years of discussion[1] on vertically centering text in a div. It's all siegeworks-engineering[2] anyway, so no surprise that we ended up here.

I think at one point in time, poor Doug Crockford suggested actual versioning for things like javascript and CSS. The children shivered as though they had been visited by a ghost! And after brushing the chill aside, returned to our great undertaking of cramming as many different languages into a .js file as humanly possible.

[0] https://www.widewalls.ch/andy-warhol-piss-paintings/

[1] https://stackoverflow.com/questions/2939914/how-do-i-vertica...

[2] http://2ality.com/2011/03/javascript-how-it-all-began.html

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

#42
CSS is not hard. Design is hard. Putting a technical barrier between yourself and a decent design makes designing a little harder. But CSS is just obscuring a really tough problem. One thing that makes CSS seem tough is its incompatibility with the design process. A "simple" design change can mean many many lines of CSS or CSS that is simply incompatible with existing CSS/HTML structure. The best CSS writers I've known all have backgrounds in design/art. It's a long term play, but I'd say invest in learning to design. Forget about CSS for a while.

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

#43

I work as a frontend architect and UX lead (yes, it's tiring), and you're encountering a common problem. Javascript is logical (sort of...), and a lot like learning math. It's fairly easy to validate your output. It works well with the logical side of your brain. Learning CSS is a lot like learning English. There's the basic grammar, but also tons of edge cases, dialects, and straight up absurd rules (Buffalo buffalo…

A layout engine and design are two entirely different concepts.

CSS has nothing to do with design. It is the tool used to implement the design and there are loads of other layout tools out there that don't have CSS's infuriating quirks. On the flip side, they usually have steep learning curves because they are strict.

For a long time, until less than a decade ago, designers knew nothing about CSS. They'd do a design in pictures and their design would be implemented by a programmer.

Some (unlucky) programmers entire job was turning PSDs into HTML and CSS.

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

#44
As anything, CSS requires practice. Imagine writing Haskell after having experience only with Python or C — you will probably expect it to be different — and difficult. You will probably want to read a book or two about Haskell, going from the first principles to real-world programs. Starting directly with real-world problems in Haskell will probably leave you frustrated and confused.

Perhaps you were never interested in CSS, and never gave it much thought; but it too has its own basic principles, after learning which it will be easy to say, like you want: "hey, CSS, this is the parent div, and all child divs must obey its size".

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

#47
I always end up having problems using css to do layout, like you mention that it's often a pain to center things. I prefer tables for a lot of things that I'm not "supposed" to use table for because the css methods don't work the same in various browsers, or at all in older ones.

css for markup works fine for me.

A humorous experience for me is when I look up some css concept I can't remember the details and find sites and blogs by css gurus about it, but their site is a total mess, unreadible, with for example letters as large as the screen, all readible text in a div that is off screen, etc, and turns out their blog only renders properly at all when viewed in Chrome. Seems there's lots of css experts that advocate for weird features which only work in one browser.

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

#48
Yes, it is horrible. It's got a little bit better (think flexbox and CSS grid) but it still feels clumsy, unintuitive, unpredictable, inelegant, frustrating. You learn to live with all it's painful shortcomings, but you'll never learn to like or love it.

Interesting aside: what would the creators of CSS do differently today?

Bert Bos:

- Feels there was too little detail in the first CSS spec (but Håkon Wium Lie thinks there wasn't enough)

- Wishes there were more ways to display link behaviour e.g. expanding/collapsing text

- He wanted to create CSS syntax that was readable for people who were not programmers

- He preferred a full stop (period) to mark the end of a group of statements. Curly brackets (braces) to group statements was Tim Berner-Lee's idea.

- Grids should have been a fundamental part of the CSS spec from the beginning

- Prefers the idea of CSS for documents and a separate language for UI elements

- Thinks the cascade could have been made easier

Håkon Wium Lie:

- Feels there was too much detail in the first spec: the more you added to the spec, the harder it became to implement

- Thinks that margin collapsing was too complicated for v1 and could have been dropped

- Also thinks first-letter and first-sentence pseudo-elements should have been left out of v1

- Hypercard was based on the idea of cards rather than documents - he wished a CSS card element had been defined

- He didn't want border radius originally, but designers insisted and he now likes it

- The v1 spec was written without any test documents - he considers that a major mistake

- They both approached CSS in a document frame of mind and wonders if they should have considered the idea of web apps more

Source: https://www.youtube.com/watch?v=PQTpsxf7rQQ

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

#50
> Incidentally, but very likely related, I always failed to have any glimpse into how design works. I have no idea which colors "go" with which ones, and pretty much all fonts look like the same for me.

This is not related. There is no magic or natural connection between grokking CSS and having a sense for color theory or typography. They are connected by circumstance only, in that they're all useful for web design, and in that CSS can control colors and typography in the web browser. CSS is not any more an "art" thing than Javascript or C, although it is a thing with which one can make art (as are Javascript and C).

Post reply on HN