Live data from Hacker News

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

news.ycombinator.com

341–350 of 358 posts

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

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

> The idea with CSS was that we would be able to separate content from presentation

I've been a frontend dev close to 5 years now, and recently I read the entire CSS spec front-to-back in scrutinizing detail for a project.

If the goal was really to decouple presentation and content then CSS has failed spectacularly. Having element selectors, attribute selectors, child and sibling selectors, very tightly couples the content with the layout. It also has the ability to affect content by inserting text nodes for example using the 'content' rule.

I'd say one big gotcha that trips up most people is not understanding when a style is valid or not. Certain styles are only valid for certain display types (see the CSS spec). Also look at the non-normative references on W3C for the default style sheet to see what default rules get applied to elements

To really fully keep content and presentation decoupled you have to stay away from those things and use something like css modules or similarly have a one-class-per-component rule.

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

#342
post #340
post #339

Earlier quoted context omitted.

My main focus is on "productivity" applications and CRUD, not so much documents. One doesn't typically index applications in a Google-esque way. I don't propose we throw out all the Web, but rather create (or extend?) standards for the things HTML/DOM/CSS do poorly. My apologies for not making the scope clearer. (Maybe that's why I got a "-1" score.) And, there may still be a markup language with text as text and oth…

Can't you already do everything you propose with the HTML canvas element then? But I can't see why you would want to render something as mundane as a CRUD UI through such a complex and slow scheme. For perhaps a game or some truly unconventional UI, it makes sense to use SVG or canvas to render it. But then you also want the rendering logic on the client (in JavaScript) because it would be far too slow to round-trip…

I haven't seen a good realistic example of the canvas element doing what I expect. Didn't you even admit "canvas" is overly complex and slow, or did I interpret that wrong? I'm not sure what you mean about JavaScript either. Perhaps an example?

As far as character strings, I don't propose rendering text via vectors. But PDF's do control text position far better than HTML/CSS can or does. I realize there's a lot of details to define and work out, but HN is probably not the place to iron all that out.

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

#343
Read the full CSS spec:

https://www.w3.org/TR/CSS22/

https://www.w3.org/TR/CSS22/sample.html

And the W3C flexbox and grid specs

Recently I read the full CSS spec front-to-back in detail, and I can say that it was so totally worth it. Tutorials don't cover a lot about CSS. Once you read it you'll know things about CSS that most devs think is a mystery

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

#344

Read the full CSS spec: https://www.w3.org/TR/CSS22/ https://www.w3.org/TR/CSS22/sample.html And the W3C flexbox and grid specs Recently I read the full CSS spec front-to-back in detail, and I can say that it was so totally worth it. Tutorials don't cover a lot about CSS. Once you read it you'll know things about CSS that most devs think is a mystery

Some might consider this radical, but if one considers how long CSS will be around, and intends to live in the web development world, it certainly would pay off. There's nothing like the feeling of true understanding.

Not the kind of reading material most people would turn to, admittedly. I've recently found this:

http://book.mixu.net/css/

It feels like a good balance between quotes straight from the spec, and explanation from the author.

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

#345
post #342
post #340

Earlier quoted context omitted.

Can't you already do everything you propose with the HTML canvas element then? But I can't see why you would want to render something as mundane as a CRUD UI through such a complex and slow scheme. For perhaps a game or some truly unconventional UI, it makes sense to use SVG or canvas to render it. But then you also want the rendering logic on the client (in JavaScript) because it would be far too slow to round-trip…

I haven't seen a good realistic example of the canvas element doing what I expect. Didn't you even admit "canvas" is overly complex and slow, or did I interpret that wrong? I'm not sure what you mean about JavaScript either. Perhaps an example? As far as character strings, I don't propose rendering text via vectors. But PDF's do control text position far better than HTML/CSS can or does. I realize there's a lot of de…

No I don't think canvas itself is overly complex and slow. Canvas is fine when you need to go beyond what is possible with HTML and CSS.

I'm saying your proposal to perform rendering on the server and just stream pixels to the client is going to be overly complex and slow. Just imagine how you would implement a hover effect using this scheme. Or screen resizing. Or scrolling...

> But PDF's do control text position far better than HTML/CSS can or does.

You can place text precisely using absolute positioning in CSS. It is just rarely a desirable approach since the layout will not adapt to screen size.

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

#347
post #345
post #342

Earlier quoted context omitted.

I haven't seen a good realistic example of the canvas element doing what I expect. Didn't you even admit "canvas" is overly complex and slow, or did I interpret that wrong? I'm not sure what you mean about JavaScript either. Perhaps an example? As far as character strings, I don't propose rendering text via vectors. But PDF's do control text position far better than HTML/CSS can or does. I realize there's a lot of de…

No I don't think canvas itself is overly complex and slow. Canvas is fine when you need to go beyond what is possible with HTML and CSS. I'm saying your proposal to perform rendering on the server and just stream pixels to the client is going to be overly complex and slow. Just imagine how you would implement a hover effect using this scheme. Or screen resizing. Or scrolling... > But PDF's do control text position fa…

It would generally be vectors sent, not pixels. If the kit or standard came with decent and common GUI/CRUD widgets and related attributes, then one would not typically need to re-implement hover indicators etc. on the client. (There might be a "hoverbordercolor=blue" attribute, for example to override the default hover color. And normally you wouldn't mess with the default.)

It shouldn't be slow and bandwidth intensive if you stick with typical and common stuff for productivity applications. If one values eye-candy and fancy animation above productivity and reliability, then they can use the existing standards. I don't propose replacing everything, just supplementing and/or extending for work-oriented stuff.

And CSS's existing absolute positioning is not absolute in my experience. I get different results in diff browser brands/versions/OS-settings. Screen size adapting was covered in another sub-thread. People are so used to thinking in terms of HTML/CSS that I have a hard time explaining what I have in mind. I may need to make a more thorough write-up.

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

#348
post #93

My wife is a technical designer for jeans and recently started learning web development because we moved and there wasn't much denim industry. She turned out to be good at CSS and I think it's similar to making jeans. From looking at the overall shape and style you can't easily construct a pair of jeans. People with artistic style can sketch a pair of jeans but to actually go from that to the specs that go to the fac…

Half the problem is that we got spoiled from WYSIWYG tools of yesteryear. Drag-drop-boom!-Done! But it turned into rocket science when dealing with web browser "auto-flow" and "responsive" design. Something that took 20 minutes in WYSIWYG now takes 4 weeks UNTIL you get proficient[1], and then the new different "in" layout framework comes along and you have to start at square 0 yet again. (Okay, maybe square 0.5 since some experience may transfer.)

It often seems like it would be easier to make 3 WYSIWYG designs for small, medium, and large screens. The device and/or server would pick the best fit of the 3. In other words, WYSIWYG x 3 Reinventing 3 wheels is easier than reinventing one rocket.

Footnote 1: Often people fudge them to work most of the time, but glitches often show up over time as new browser or OS brands/versions come out and expose one's accidental fudging-based version lockin.

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

#349
post #85

It's not just you. Treating the web like a native UI framework, where you can set pixel positions directly to get the perfect layout, isn't going to work. The trick to using CSS effectively is to give up on achieving whatever design goal you have. Instead, you should settle for what CSS actually lets you do. Don't try to align text to the pixel; change your design so it doesn't require precise alignment. Ideally your…

Everything is "easy" once you learn it. Rockets and brain surgery are second nature to experienced rocket scientists/engineers and surgeons.

As I mentioned elsewhere, something that used to be quick and simple in WYSIWYG tools now have a giant learning curve and/or require lots of fiddling time to get working. It's hard to believe we must go from bicycle science to rocket science to make everyday software. We are not trying to make Mona-Lisa's, just get-er-done software that's relatively easy to use for end users. This alleged must-ness bothers me. It makes one feel there's a Grand Invention missing that will bring back the grand simplicity and speed of WYSIWYG tools.

It's as if we finally got flying cars in the 1990's (WYSIWYG tools), and then they are all yanked away from us and we are back to 2D roads.

Who shot the Jetsons?

Post reply on HN