Live data from Hacker News

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

news.ycombinator.com

321–330 of 358 posts

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

#321
The main things you should learn to become decent at CSS are:

- the box model

- how cascading, specificity, and inheritance work

- googling CSS problems with the site:stackoverflow.com filter

Bit tongue-in-cheek with that last one, but the rest will give you a solid understanding of why certain things work the way they do when your code doesn't look the way you expect.

> I can't do anything basic on CSS without turning for help

The thing is, if you are working with a whole website (even simple looking websites can have a lot of HTML and CSS), then there are often no "simple" problems, at least with layout, because every element can and often does affect every other element.

Sometimes you just need a good old analogy or picture to demonstrate some things: https://stackoverflow.com/questions/33132586/why-isnt-my-mar... (disclaimer - I wrote that answer). In a lot of ways, your elements and their CSS are like rocks in a river... the water/document flows around them in certain ways, which affects stuff around them or downstream. Removing one or adjusting it can change how the water/document flows, and thus can affect other rocks/elements, etc.

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

#322
post #300

Earlier quoted context omitted.

> CSS works the way it does because it was created to make the kind of designs that designers wanted possible Well, not originally. Later that became a thing, yes - but all the design that was already there at that point (circa CSS 2) remained, as did the overall approach with cascading styles. A styling language designed for HTML5 today from scratch, accommodating modern use cases, would likely look a lot different.

^this I think the best illustration of this "fight" between CSS as a tool for styling "traditional" hypertekst documents, vs CSS as a tool for styling "web pages" is the fate of Adobe's CSS regions proposal - and Håkon Lie's opinion piece arguing against it: https://alistapart.com/blog/post/css-regions-considered-harm... That was when "design" lost. But now with grid and transitions, there's a "new" CSS - one that is…

I just wish we decoupled apps and sites, instead of forcing it all together in a large and incoherent design. This is especially painful now that it's spilling over into the desktop world because of all the Electron apps.

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

#323

Earlier quoted context omitted.

> hey, just center this thing Step 1: On your container div... display:flex; justify-content:center; align-items:center; Step 2: There is no step 2.

this won't work on bootstrap elements

Another reason to avoid bootstrap if possible. I wouldn't touch that thing with a 10 foot div.

Each to their own, but it's better to make your own templates, unless your primary role is something other than frontend dev and you want the equivalent of store-bought pasta sauce instead of making your own pasta sauce.

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

#324
post #126

1) CSS is for implementing designs; being able to use it doesn't require design sense for things like colors 2) I'm fascinated by the fact that so many of my fellow programmers - often the smartest ones - have so much trouble with CSS. I'm not sure exactly what the reason for that is, though I did write an article hoping to address it in some capacity: https://css-tricks.com/css-is-awesome/ I think part of the proble…

> many programmers, who like things to be orderly, see CSS as arbitrary and chaotic.

It is arbitrary and chaotic. It breaks the principle of least astonishment.

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

#328
CSS is utter crap. In the history of computers, one programmed in a single language at a time. You had punch cards, then a text file in a terminal, then a text file in a PC written in a language like FORTRAN, COBOL, PL/1, Java, etc. And it was fine. Then they invent a bizarre 3 language sandwich where you switch back and forth between 3 completely incompatible languages (CSS, HTML, JS), which don't even agree on how comments are entered. It is one of the worst designed languages ever, surpassing the previous abomination RPG. I can't wait to deep six the whole HTML stack, as it is a huge time waster. We need a single, well-designed language that can all the general purpose coding we need (and generate websites). Maybe the output will be JS because that is what browsers support today, but seriously let's not put lipstick on a pig and call it pretty. That CSS can draw but not compute, and JS can compute but not draw, and HTML can't do IF, what kind of nutty design is this? Chaotic rapid growth was the cause, but the cure is to dump it entirely.

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

#329
most has been said, but I want to add that the pragmatism of the language makes needed effort unpredictable.

many solutions seem to be born out of the fashion of that time. an animated dropshadow is easy, styling a checkbox, it's label and making it work for rich devices is damn hard.

(for the latter you need to figure out the way to associate a label with a checkbox, hide the default checkbox, draw your own to style that, somehow get the state from the hidden original checkbox and than build a very weird wrapper, that invisibly enlarges the clickable/touchable area without bursting your layout or covering another touch zone)

I think medium did a whole blog post on how to get aesthetical authority over a text undergone.

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

#330
post #307
post #304

Earlier quoted context omitted.

> I'm of the strong opinion the "layout engine" should be on the server and that the browser should be a dumb x,y,z coordinate polygon plotter. OK...so if you search for something on google you need to know the coordinates for every pixel in the rendering of the text you are looking for?

Who is "you" in your scenario? It would be similar to printer formatting languages. The printer driver translates a document into lines, vectors, and polygons, and sends those to the printer as page coordinates, except the page length is not limited to paper's limit. (We'd probably have to add event triggers on designated polygons to handle UI interaction.) The equivalent of the "printer driver" is the rendering engi…

My question was, how would Google index pages and make them searchable in this system?
Post reply on HN