Live data from Hacker News

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

news.ycombinator.com

261–270 of 358 posts

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

#261
post #57

CSS is almost a failure as technology. None of it's promises has been realized. The idea with CSS was that we would be able to separate content from presentation. Remember CSS Zen garden? Yet that has never been the case and div tags were always needed to be able to display something simple. Another promise was that content would be displayed easily on different mediums, desktop, mobile even print.. yet it's impossib…

My heretical view is that it's time to abandon CSS. You already generate your HTML with some program (whether server-side or javascript) that takes a canonical, normalized representation of your content and spits out repetitive HTML elements (one pattern of elements for a button, another for a calendar, etc). Have that same program apply inline styles on elements that need styling.

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

#262

My frustrations w/ CSS stemmed from not having respect for the complexity of the problem that CSS solved. I went into it w/ the same attitude of "hey, just center this thing", and didn't really get anywhere. These days I have accepted that CSS is a tool for pros, which I am not.

> 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.

Yeah, with flexbox we can finally do the layouts we could do with tables since 1996, and it's only a little harder.

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

#263
post #142

Earlier quoted context omitted.

CSS is not a real constraint language. If it really were a constraint language, it would be better. There's no constraint solver. Just a bunch of rules applied sequentially. 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 lay…

> Amusingly, tables came back. But they're called "layout tables" now, to avoid embarrassment. I'm not really sure what you're talking about. Tables were bad because they were too rigid and weren't designed for layout purposes; they do still get used when you want to display an actual table. Maybe you meant CSS Grid? > Trying to do 2D layout with 1D constructs (the "float" and "clear" era) was just silly. The float e…

You know your comment in hacker news is rendered as a table :)

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

#265

Earlier quoted context omitted.

I must be missing something, because isn't 3 images side by side just: ? 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.

You are somewhat correct. I just tested with the tiny HN logo (upper left of this page), and a div with 3 imgs makes them appear side-by-side. The issue I had previously was that the three images were quite wide, and while I wanted them to still go next to each other (with a horizontal scrollbar in the browser), the browser moved images into a new row if they would overflow past the right edge. I haven't used JavaFX…

Aren’t imgs inline-block by default?

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

#266
post #243
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…

> 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 I will demonstrate why. First, think of all the tools that you use that require a text interface. That may include a programming language (python, ruby, javascript, etc), a command line shell (bash, fish), a database client (mysql, psql), a conf…

To add to your last bit: the fact that "absolute" is relative to the closest non-"static" parent is a sign that things aren't as decoupled as they seem. Same with how "overflow" mixes scrolling and clipping.

CSS is a badly specified mix of a unidirectional constraint system, a typographical system, a compositor and a declarative transition/animation system.

While there is by now a CSS: The Ok Parts, there are no good parts because they hang off the bad parts.

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

#267
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…

I've always found people who struggle with CSS don't really know how CSS works and never studied as well as any other language or tool they use. They do a quick read of an article somewhere, ask a question on reddit, get an answer from some 15-year old kid, it doesn't work, and they give up. Yet they own whole book shelves on the latest trendy framework or language they are using.

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

#268
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 style…

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

I feel the same. I fiddled with css on personal projects just fine, but in my job, diving into years of accumulated, imbricated classes is a nightmare and even though I try, 80% of the time I end up passing the problem to the design team.

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

#269
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…

You make a good observation that:

> The browser has lots of default, complex behaviors that drive layout, and […] CSS is more about […] guiding that automatic engine

I think for most people who struggle with layout, what they really need to learn is what process the browser uses to lay out content, so that they can then turn their mind to how to guide it. Instead, I've seen hardly any CSS tutorials / documentation that start with a description of the layout algorithm and what hooks it provides via CSS; they all start from the meaning of individual CSS declarations, which are never the full picture.

I think there's really room for teaching layout from the other end (the following is the browser's algorithm, and here's what can influence it), for people who think procedurally.

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

#270
I picked up CSS last year because I always felt bad I never really put my time into it while I had to use it so often, I'm not a designer by any means but I like to experiment things out, but what I got from what I learned is that CSS works in its own way, it's not that much about "I want this div in this position" but more like "Everything in your page must flow a certain way" and from the experience I've had with certain inhouse "frameworks" it seems like other people dont get it either.

I think that in that sense CSS still irks me a bit, I still do a lot of things that just feeeel like a hack, but from what I search and google around it seems like that's the only way to do it? but I also think it's kinda fun, I like reading the MDN web docs from time to time and they do seem to explain things very thoroughly, I've had a lot of moments where things started to click after reading it.

Post reply on HN