Live data from Hacker News

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

news.ycombinator.com

281–290 of 358 posts

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

#281
post #237
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 itself isn't a bad idea but less, scss etc. showed that it was lacking some features you desperately want and in the meantime just styling the web with "a little CSS" is not enough anymore. You have a shitload of display sizes to support on the other hand and strange behaving browsers which aren't truly standardized on the other. That makes adjusting your CSS to all of these a pain in the ass even if you like fid…

Imo as long as you're not targeting internet explorer, things are pretty consistent these days. All modern browsers are now "evergreen", which means they update automatically and silently, which is the best thing in the world for web devs. The only inconsistencies you get are some having implemented new features before others, not really outright contradictions, and even that isn't a very big gap these days.

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

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

Some of the names are unintuitive, sure. Though I don't think the ones you provided are in particular; I think your distaste for those is subjective. But it's really not hard to learn the names for concepts which themselves make sense (at the beginning, perhaps, but not for someone willing to put in a modicum of effort).

Many of the worst parts of CSS, and even JavaScript for that matter, come from the need for backwards-compatibility. There are literally websites from the 90s that still render and function perfectly fine in a modern browser. That's an amazing property of the web, and I'd say it's worth the tradeoff of living with a few questionable decisions of the past. Plus, we continue to rapidly build new features on top of those backward-compatible ones, so it's not like we're truly held back by them. Modern CSS and JavaScript are barely recognizable from the 90s versions, but they still contain those as a subset.

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

#283
I arrived at CSS and HTML from a background in print layout with Adobe PageMaker and InDesign in the 1990s. Professional layout programs like InDesign attempt to separate content from layout and styling. The first step in creating a print document is to set up a grid of empty containers. The second step is to fill those containers with placeholder text (often Loren ipsum). Step three is to develop a style sheet to style the text so that styles can be updated in one place and applied consistently throughout a document. The last step is to flow content, written as plain text in an external copy editing tool, into those containers.

Coming from that background, HTML (the document structure) and CSS (the style sheet) are relatively intuitive. I can see how they were influenced by tools like InDesign. However, browser quirks are very frustrating. I try to avoid situations where I need to deal with them, or if I do I try to find CSS written by others that guides the way.

I think it’s probably unfortunate that screen layout techniques, where screens are variable size and interactive, were so heavily influenced by print layout, where pages are of fixed size. On the other hand, maybe HTML + CSS was too influenced by Microsoft Word style desktop publishing where layout and content are in a single document and not influenced enough by InDesign style publishing were layout, content, and structure are each distinct. But relatively few people are ever exposed to professional print layout tools like InDesign.

Having recently gotten into parametric CAD and constraint based design, I’m hoping to see more of that approach make its way into both print and screen design.

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

#284
So back in the day you had to know a lot of weird tricks. The goal was usually to make it look the same in every browser so you had to know the differences between them and what caused them. I think that's why I don't find it very hard today, even though I don't do much CSS it usually works. With the changes to CSS since then, that old knowledge might be a lot harder to find for newcomers.

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

#285
post #184

Earlier quoted context omitted.

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.

I've got to disagree. Your preference for text emails doesn't mean those who do want rich-text or HTML should have to put up with crappy rendering that requires specialist developers. I don't understand why HTML payloads can't just be loaded in a (streamlined) browser pane?

They are; it just tends to be a really crappy browser pane that isn't based on (and therefore kept up to date with) any major browser, so writing the HTML and CSS is like being transported back to 2004

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

#286

Earlier quoted context omitted.

> Your Autodesk comparison belies a fundamental misunderstanding about the nature of the DOM - it is, to its great advantage, a 1D space which flows into a 2D shape. What's the advantage? The screen is 2D space. Layouting is a 2D problem. Images are two-dimensional. It's simpler to start from 2D and make 1D content fit that space than the other way around. > The web is 1D because text is 1D. That made sense in the ve…

> What's the advantage? The same content reflows to different 2D spaces

Flow-like layout is just a sub-problem of 2D Layouting. Having it as the only way to do layouting (besides tables) has proven a nightmare to work with. That's why you got Flexbox (and now Grid).

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

#287
Think this way: You html is a tree of tags. You have to layout this tree.

Each tag is a box that can contain other boxes. Learn about the box model to understand the properties of a box.

How do you display the boxes inside another box? Learn about the display property.

How do you position the box inside another one? Learn about the position property.

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

#288

Earlier quoted context omitted.

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…

I don't think sass/less complicate this, they just bring in some familiar and useful elements. How much further could css have gone on its own had it supported variables and functions from the get-go?

SASS is incredibly helpful so I think it is worth the pain. It is game changer, and still it can be learned in a few hours. Before SASS, managing z-index across a whole template or changing colors was a nightmare.

(If you are old enough, you may have come across one of those WordPress templates in which they crammed PHP $variables inside inlined CSS. #goodolddays)

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

#289
CSS is pretty simple and like a programming language you can overwork it to high complexity. And most people who aren't used to how to optimize it, just make a usable kludge of CSS.

When I first was going through CSS to learn it I thought it was the worst thing in the world - manly because many people had copied CSS without knowing what how to really achieve - or inheriting disparate css blocks which add to the confusion.

Once understood and starting from scratch, you can make it a lot more logical and flexible without much of a mess. My big tip - learn to break down style parts into separate classes and then combine the classes as needed!

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

#290
post #285

Earlier quoted context omitted.

I've got to disagree. Your preference for text emails doesn't mean those who do want rich-text or HTML should have to put up with crappy rendering that requires specialist developers. I don't understand why HTML payloads can't just be loaded in a (streamlined) browser pane?

They are; it just tends to be a really crappy browser pane that isn't based on (and therefore kept up to date with) any major browser, so writing the HTML and CSS is like being transported back to 2004

Dunno why Gmail doesn’t support everything. It’s in a modern browser already!

https://templates.mailchimp.com/resources/email-client-css-s...

Post reply on HN