Ask HN: Is it just me, or is CSS too damn hard?
131–140 of 358 posts
Re: Ask HN: Is it just me, or is CSS too damn hard?
#1321) 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…
I'd like to have a real constraint system, like the one in Autodesk Inventor sketch mode. You select two things and apply a constraint - parallel, tangent, horizontal, collinear, etc - and the constraint system enforces those constraints. The layout GUI tells you if you've created a conflict. CSS solves an easier problem, and not very well. It's such a mess that no one can attach a decent GUI to it.
Amusingly, tables came back. But they're called "layout tables" now, to avoid embarrassment. Trying to do 2D layout with 1D constructs (the "float" and "clear" era) was just silly.
Re: Ask HN: Is it just me, or is CSS too damn hard?
#133As a technology, like all things related to how browsers work really, CSS is not really a well designed part of a wholesome and complete architecture, but an accidental feature on top of a pile of an accidental agglomeration of features.
CSS is not art. It's just accidental complexity. It's totally understandable to me if it seems weird.
But if you need to learn it - maybe train yourself by small examples? Maybe you are trying to understand the layout of a complete and complex page? What if you implemented simple HTML pages by hand of increasing complexity and figure how CSS affects those? People are different learners but this sort of thing helps me along often.
And the font thing - typography has a long history. Since the chances are fairly good that your designer counterparts are font afficionados it never hurts politically to familiarize oneself at least with the history of the craft and to identify serif fonts from sans serif ones.
https://en.m.wikipedia.org/wiki/Serif
Re: Ask HN: Is it just me, or is CSS too damn hard?
#1341) 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…
People have developed some techniques to mitigate these issues, but many are unintuitive and don't follow naturally from "make this thing look this way".
Re: Ask HN: Is it just me, or is CSS too damn hard?
#135I 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…
I think there's edge cases, dialects, and straight-up absurd rules in JS too. I don't think CSS is any less logical... but some might not be use to _declarative_ languages like CSS is?
I don't think it is caused by this aspect of CSS.
The problem could come from the fact that it mixes 2 purposes: style AND layout to apply it globally with rules that get harder to understand the bigger the project.
Re: Ask HN: Is it just me, or is CSS too damn hard?
#136I'd just want to point out this is completely unrelated: the best people I know when it comes to designing interfaces (both UI and UX) don't know much CSS. That's very much a creative field.
I can do CSS without many problems (nothing too fancy but slicing any interface or basic flexbox grids for layout and such). CSS isn't complex, just very foreign. Understanding the "rules" (cascading, priority) isn't hard, but knowing how to use it (how to target the element you want, what css to use to get the positioning/styling you actually want) takes a lot of practice. Though when it comes to creating a beautiful page I'm of no use.
Re: Ask HN: Is it just me, or is CSS too damn hard?
#137I 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…
[1]: https://en.m.wikipedia.org/wiki/Buffalo_buffalo_Buffalo_buff...
Re: Ask HN: Is it just me, or is CSS too damn hard?
#1381) 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…
Beyond the immediate issues of "what rules do I use to make this thing look this way", the cascade can also make large-scale management and code reuse challenging. It's sort of like object-oriented inheritance, except the definitions and instantiations live in totally different places, and the top-level object properties are defined by browser manufacturers, or possibly end-users. Without some sort of build system, s…
With the key difference being that there's no rigid structure to it at all, much less a strict-subset hierarchy. It's really more like structural object types, which can be easily composed, than OOP classes. It's set theory, rather than taxonomy.
> Without some sort of build system, static analysis is difficult so it's hard to say if a definition is being used or not
This can be easily solved with good project organization. At my day job I maintain a codebase with a couple hundred SCSS files, which are on average a couple hundred lines each. We've organized things well enough that the cascade is a non-issue, and "leftover" styles from an element that's been removed are a rare occurrence. All you have to do is closely mirror your UI components, pages, fragments, whatever, with the relevant CSS files. Then if you add or remove something in the markup, you add or remove it in the corresponding styles.
> don't follow naturally from "make this thing look this way"
This is precisely the problem; programmers come from a background where they think in terms of "make it do this thing", and they try to translate that to "make this thing look this way". That's how you create supremely fragile CSS which is impossible to safely make changes to. Instead you should be thinking in terms of, "make it behave this way in the general case, relative to what's around it".
Re: Ask HN: Is it just me, or is CSS too damn hard?
#139Earlier quoted context omitted.
The sad thing is that by the 1990s we'd figured out how to do good UI design for desktops, but then we promptly forgot every single bit of that knowledge when the web came along.
But the web wasn't supposed to be a UI platform - it was supposed to be a medium for delivering text with some images and media occasionally interspersed. Hyper text markup language. Java applets could use Swing to get a normal-ish desktop UI and still be close to the web. But we keep trying to cram a UI framework into HTML/CSS. The standards are slowly mutating and eventually they may provide a good UI framework. Ja…
? But you're right, the web isn't a UI platform. It's designed for to produce things that are like Microsoft Word documents. Web-apps are like using MSWord's scripting and text layout to produce a MSWord-app. Yeah, one can do it, but it's like cutting a steak with a spoon.
Re: Ask HN: Is it just me, or is CSS too damn hard?
#140FWIW my father struggled with CSS for countless years before retiring. The reasons were he never got his head around the DOM or the CSS box model and the fact that it all assumed you were using CSS to style a document (or more specifically, a DOM tree). He would instead want to place this/that here/there, oblivious to the fact that he was building a web page that scrolls, rather than a more familiar VB app screen tha…
Not only that but you are building a page that displays on all kinds of screen sizes so you just have no idea how much space there is between here and there. Thats 90% of what makes CSS hard because depending on what screen you are on, you can't just put something here because here doesn't exist for everyone.
I think CSS is designed fairly well its just that its solving a very complex problem of how do you make one page display on all kinds of devices without having to define layouts for them all.