Live data from Hacker News

Why is CSS the way it is?

increment.com

91–100 of 173 posts

Re: Why is CSS the way it is?

#91
post #86
post #5

I have a weird relationship regarding CSS: I kinda like it (although some things could be even a bit more powerful), yet everybody I meet tells me how horrible and hard etc it is. I never had that feeling at all, not even back when I started using it as a teenager to customise my MySpace site. I cursed at how hard common things like centering a image within a div were, I cursed at the purposeful and ignorant incompat…

Same here. Most of the devs I know who don't like CSS actually never read the docs, or really understand the box model and padding vs margin, etc. They don't treat it like a real language, and so they hate it. I've even worked with someone even recount that once they read the manual, it got a lot easier! Of course, I'm a dinosaur. I still don't know nearly as much about flex, CSS grids, etc. but i actually have very…

I understand the box model well and I still hate CSS. I just feel like CSS has way too many unique things to remember that have no apparent logic to them.

Re: Why is CSS the way it is?

#92
post #87

This is a somewhat superficial history that only briefly touches on origins, and doesn't discuss the fundamental idea behind CSS, from which everything else is, directly or otherwise, a consequence. Two decades ago I was overjoyed to discover that Scheme was finally going to have a useful application beyond illustrating SICP and writing koans to amuse myself, because DSSSL was on the cusp of evolving into the last do…

Don't forget the gigabytes of code spent trying to work around the cascade and produce some kind of framework for styling "components" that doesn't leak crazy state from the enclosing context (but does inherit the good stuff). The "cascade" was, for sure, a mistake. Not being in this world, though, I do wonder why there's been no real attempt to fix this from the ground up? I mean... it wouldn't really be "hard" to c…

The "cascade" was, for sure, a mistake.

FWIW, tailwind solves this problem (in a tedious way).

Re: Why is CSS the way it is?

#93
post #5

I have a weird relationship regarding CSS: I kinda like it (although some things could be even a bit more powerful), yet everybody I meet tells me how horrible and hard etc it is. I never had that feeling at all, not even back when I started using it as a teenager to customise my MySpace site. I cursed at how hard common things like centering a image within a div were, I cursed at the purposeful and ignorant incompat…

You can't work out the logical consequences of seemingly obvious properties. That is unlike 95% of most programming I do in any programming language I've ever used. Since I have zero interest in learning unintuitive interfaces to GUI design, I have zero interesting in excusing CSS. It is not difficult to learn, it is not difficult to understand in terms of conceptual understanding, it is downright tedious to learn th…

You've said everything I wanted to say but I wasn't able to express. CSS is nothing like programming. I am a decent programmer and I can write actual code in virtually any language that's new to me, in minutes. CSS is always tedious and God forbid I don't use it for a couple of months - then I've got to go back and re-learn everything. I'm on my fourth round of re-learning about CSS because I'm not purely a front-end developer.

Re: Why is CSS the way it is?

#94
post #44

Earlier quoted context omitted.

You can't work out the logical consequences of seemingly obvious properties. That is unlike 95% of most programming I do in any programming language I've ever used. Since I have zero interest in learning unintuitive interfaces to GUI design, I have zero interesting in excusing CSS. It is not difficult to learn, it is not difficult to understand in terms of conceptual understanding, it is downright tedious to learn th…

Probably because very few learn CSS right. In particular: the box model. All the devs I know that struggle with CSS don't understand it. The ones that don't have issues have internalized it and don't need to think about it much anymore. The box model is one of those fundamental building blocks you really should be learning very early on, a bit like an "if" statement in imperative languages - you can hack around it wi…

I keep seeing this excuse, "If you don't like CSS you must not understand the box model". The box model is easy to understand but it still doesn't make CSS good.

Re: Why is CSS the way it is?

#95
I think most of the complaints against CSS is because don't understand the problems CSS is trying to solve. It is not just a question of putting text and colors on a screen. You can do that with Postscript or PDF or SVG or several other comparatively simple technologies. CSS is trying to tackle a much harder problem:

- Layout and typography which can be readable on various devices with wildly different dimensions, aspect ratios and resolutions.

- Incrementally rendered (i.e. the start of the document can be rendered before the whole document has been loaded)

- Allow users to enlarge the text size while keeping the text legible. (In a PDF you can zoom, but then you will have to scroll vertically back and forth for each line.)

- Backwards compatible with the display model of pre-CSS presentational HTML

No other technology exist which solves all these problems. If you ignore one of more of the above constraints you can probably devise a simpler and more intuitive styling language.

Re: Why is CSS the way it is?

#96
post #87

This is a somewhat superficial history that only briefly touches on origins, and doesn't discuss the fundamental idea behind CSS, from which everything else is, directly or otherwise, a consequence. Two decades ago I was overjoyed to discover that Scheme was finally going to have a useful application beyond illustrating SICP and writing koans to amuse myself, because DSSSL was on the cusp of evolving into the last do…

Don't forget the gigabytes of code spent trying to work around the cascade and produce some kind of framework for styling "components" that doesn't leak crazy state from the enclosing context (but does inherit the good stuff). The "cascade" was, for sure, a mistake. Not being in this world, though, I do wonder why there's been no real attempt to fix this from the ground up? I mean... it wouldn't really be "hard" to c…

> The "cascade" was, for sure, a mistake.

Aren't global styles only possible because of the cascade and the child elements inheriting from parent elements? Without cascade, wouldn't you have to re-declare your font size and font family, and line-height, etc. on every element of your markup?

Re: Why is CSS the way it is?

#97
To summarize the answer in a single line: "We added it to the specification, thinking we could always improve it later"

CSS is not the only victim of this approach, just particularly bad case.

Re: Why is CSS the way it is?

#98

Earlier quoted context omitted.

Everyone loves to hate Flash, but as an environment to create things it was actually great. It was the player that wasn’t great.

Speaking of Flash and alternatives to CSS there was a whole UI language built to run in the Flash player called Flex which had an amazing layout engine. You could - in code - define your own layouts which could then be used on any components. I've been wishing someone would port this to javascript for years. Imagine if developers could have just created FlexBox when it was needed fifteen years ago instead of waiting…

Just like CSS grid has its roots in WPF grid model.

Re: Why is CSS the way it is?

#99

Earlier quoted context omitted.

> broke so many things (deep linking/bookamrks, browser history, etc.) Truly we have failed to learn from past mistakes.

Modern JavaScript frameworks have support for this and a result of Flash's experience is that browsers have specific APIs for that ... however: each new generation of developers has to learn :)

Without the Flash tooling capabilities, though.
Post reply on HN