Live data from Hacker News

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

news.ycombinator.com

181–190 of 358 posts

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

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

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…

> It's such a mess that no one can attach a decent GUI to it.

A very good point. My guess is that we could let designers do a lot more and developers do a lot less, if it wasn't for that impedance mismatch.

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

#182

The tipping point for me was memorizing "A complete guide to flexbox" from the site "CSS Tricks" by using flash cards (Anki). The problems with CSS are: - A lot of features have been abused before there were good layout features in CSS. * - Errors are silent and you can repeat rules. - Selector specificty is a major fail in the language IMHO. * - Everything is global. * * An example: floating an image is an excellent…

Multiple asterix are stripped it seems.

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

#183

FWIW 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…

holy shit i'm old.

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

#184

Earlier quoted context omitted.

> 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. And when you have to implement a email design someone gave you who think it’s more important to have it look a certain way then to implement it reliable.

That’s because the rendering engines in email software are crap, not due to a deficiency in CSS - I think Outlook still uses Word’s HTML renderer and even Gmail doesn’t support everything.

In all fairness that's probably a good thing. God forbid if emails today were like the rest of the web, hijacking the scrollbar, constant popups to register, like and subscribe.

I like my emails like I like my actual mail; text and maybe the odd image.

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

#186
> Is it common for other developers to have issues with it, or is it just me? Is there any material out there that made CSS "click" for you?

If you're coming from an application development background, you will hate CSS layouting. It's the most ass-backwards way of structuring a UI that you will ever encounter. A lot of web people who never used stuff like Qt, Swing, Winforms (etc) just don't realize this. They think there's some sense in CSS. There isn't, it's a bunch of historical accidents.

HTML wasn't designed to be dynamic, it was designed for documents. CSS wasn't originally meant to do layouting. The end result is an incredible amount of technical debt. CSS performance is a complete disaster. It's unfixable. If you need to do a non-trivial amount of dynamic content, you need to use Canvas or even WebGL and re-implement a lot of stuff yourself, but then people will complain that it's not "semantic", that it's poor design and that it goes against what HTML is meant for. It's a complete joke.

The thing is, you don't have much of a choice. The web platform is what it is. If you want to work in the web frontend, you'll have to deal with it. Alternatively, don't work there. There's other opportunities.

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

#187
post #88

Earlier quoted context omitted.

The difference is that with JavaScript, you can install a linter and happily restrict yourself to the sane subset of the language. It's very realistic to never have to deal with any of the uglier parts of JS, even as a full-time front-end developer. With CSS, you can't avoid hacks. If you try to design anything non-trivial, you will have to employ tricky non-semantic tricks, run into edge cases, and have to settle on…

What does installing a linter have to do with using a subset of a language? Just... use the constructs you're familiar with? It's not like you can "accidentally" use an ES6 class or something.

installing a linter and limiting yourself to a subset of the language has to do with the fact that most development is done in teams, so when you limit yourself you limit the team to an agreed upon good subset of the language and nobody screws you over because they think the with statement needs a workout.

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

#188

Earlier quoted context omitted.

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…

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 in a while but I'd bet there's a checkbox you can toggle in the builder GUI to control how an HBox overflows.

The solution for HTML/CSS was to give the outer div "white-space: nowrap" and the three inner divs (with images inside them) "display: inline-block".

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

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

Good comment. CSS is actually pretty simple, as long as you start with the smallest elements and work up. It becomes a nightmare if you try and address everything individually. It’s not really a programming language, but a series of guidelines. I’ve seen this simplicity actually throw developers as they’re used to something much more complex and systematic. Preprocessors like SASS are great, but I wonder if they’re d…

Pixel perfect is not possible in HTML/CSS. Stop spreading this.

But it is very possible to make websites look very good and inline with what was designed.

But good luck making an input, button and select the same height. It's just not going to be pixel perfect.

What is pixel perfect in your browser isn't in others.

But what designers should now is it doesn't matter as long as it looks good for everyone.

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

#190

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…

If anyone doesn’t get the “Buffalo buffalo...” reference here’s the Wikipedia about that bizarre English sentence [1]. [1]: https://en.m.wikipedia.org/wiki/Buffalo_buffalo_Buffalo_buff...

Oh wow. I'd always just assumed it was a US idiom along the lines of yada yada or something. Buffalo buffalo... doesn't work in British English as it is only a noun.

Nearest English silliness I can remember hearing is: police police police police.

Post reply on HN