Live data from Hacker News

"CSS is dramatically more difficult than learning assembly language" [audio]

feeds.resonaterecordings.com

91–100 of 109 posts

Re: "CSS is dramatically more difficult than learning assembly language" [audio]

#91

Earlier quoted context omitted.

No, because like I said, CSS later introduced other layout systems that weren’t based upon this.

I reccomend listening to the podcast that the thread is about, where Casey Muratori discusses the many failings of CSS as a layout specification language. https://twitter.com/sw_unscripted/status/1730707950518309109

That’s more than two hours long. Is there a specific point in it you are referencing?

Re: "CSS is dramatically more difficult than learning assembly language" [audio]

#92
post #32

I cannot look at a UI design and intuitively know what CSS attributes would generate that exact output. I think part of it for me is that I do not have an intuitive understanding of the box model and how layouts are calculated. On top of that, since CSS cascades, you have to be able to mentally keep track of all the parent attributes to understand how they affect a specific element on the page. I was working on a Rea…

> I ended up just playing around with putting attributes on various components until I found what worked. I think that's what everyone actually does when doing CSS.

If you have the liberty to limit your team to a subset of modern CSS features that have predictable behavior and patterns of applying styles (like never putting margins directly on a component, always spacing things from the parent; along with a laundry list of other conventions); and your site is designed to not do weird painful stuff (eg masonry layouts, though that should become a native CSS thing soon!) then I find it’s pretty predictable to do 95% of layouts, and only the weird outliers require special sauce. But then again I do a B2B SaaS that doesn’t need to look shockingly sexy, with lots of standard CRUD dashboards so maybe our use case is light on weird CSS tricks required.

Re: "CSS is dramatically more difficult than learning assembly language" [audio]

#93
As with any other technology, difficulty is relative and a function of experience.

For me, CSS is easy even though I rarely work with it professionally (I mostly work on backend and infrastructure these days). Yes, there are scenarios where I get stumped but a vast amount of literature and helpful community gets me to places I need to be, just like many other technologies.

Re: "CSS is dramatically more difficult than learning assembly language" [audio]

#94
post #32

I cannot look at a UI design and intuitively know what CSS attributes would generate that exact output. I think part of it for me is that I do not have an intuitive understanding of the box model and how layouts are calculated. On top of that, since CSS cascades, you have to be able to mentally keep track of all the parent attributes to understand how they affect a specific element on the page. I was working on a Rea…

Box model + flex box + the display modes + "positioning" (stacking contexts) are typically the most confusing parts of CSS, I feel. Add maybe margin and padding, and how they interact (margin collapse, no margin collapse in flex or grid context, box model again, auto values). But then, that's basically all the hard conceptual parts. But they are mostly intuitive and well-designed! I know I'm alone with this opinion.…

I've found people have the most trouble taking full advantage of the cascading feature of css.

Re: "CSS is dramatically more difficult than learning assembly language" [audio]

#95

slightly OT but can someone recommend how to learn CSS in 2023 for a backend web developer, who 30ish years ago grokked mainframe Assembly reasonably well (and since then developed in c, php, python, ruby, bash, etc etc)? Can/do I start with tailwind? Do I start with old-school CSS or jump straight into flexbox? Do I need to care and learn about BEM, Sass, etc? Do I start with an empty page and build it? Do I need to…

Do not start with Tailwind. If you have no grasp of CSS beforehand, Tailwind will be completely incomprehensible. At the basic level, Tailwind is giving you shorthand CSS properties. You need to learn CSS first.

Re: "CSS is dramatically more difficult than learning assembly language" [audio]

#96

slightly OT but can someone recommend how to learn CSS in 2023 for a backend web developer, who 30ish years ago grokked mainframe Assembly reasonably well (and since then developed in c, php, python, ruby, bash, etc etc)? Can/do I start with tailwind? Do I start with old-school CSS or jump straight into flexbox? Do I need to care and learn about BEM, Sass, etc? Do I start with an empty page and build it? Do I need to…

Personally, I wouldn't mess with tailwind until you have the fundamentals of CSS sorted out. To use a PHP example...Whereas you're actively writing a lot of PHP when using frameworks like Laravel or Symfony, and can learn from that process, you're not really writing a lot of CSS with tailwind. You're mostly just adding classes to elements and supplementally adding some styles on top of that.

I would jump right into modern things like flexbox and the grid system as the old ways of floating are basically useless. I mean they still work, but I can't remember the last time I had to use a float to create new layout. Start with flex, as it's a bit more beginner friendly than grid is. I've been doing this for nearly 20 years now and I still struggle to wrap my head around grid sometimes.

You can ignore BEM until you've got the fundamentals sorted. BEM is just a clean standardized way to organize class/id names, it's nothing functional.

Sass helps streamline things a lot via nesting and variables to begin with. More advanced features can also be useful, but until you've got the fundamentals it may not be clear where those advanced features can be applied. And Sass requires substantial more initial setup than plain CSS (you'll need Webpack or gulp or something to turn the Sass into CSS). Not to mention that Sass's biggest draw is variables and nested styles, which CSS now supports natively (albeit with really weird syntaxes, imo). So I'd skip Sass for now.

And yes, you can jump into an existing page and tweak it. That's how I learned it initially. https://csszengarden.com is a good resource for that. It's the same basic HTML site with different CSS themes you can load. It's a good showcase of how powerful CSS is what you can do with it without touching the underlying HTML. Dev tools are very useful there as you can turn individual styles off, change their values, etc.

Lastly, I'd just start with a blank page and try to create a simple 2-column layout. Narrow left column with a basic navigation in it and a wide right column with a few paragraphs of text in it. Then build off of that -- add a header and a footer. See if you can get the header to "stick" while you scroll down the page, etc.

Re: "CSS is dramatically more difficult than learning assembly language" [audio]

#98
A rather ridiculous assertion, if you ask me. CSS is quite easy to grok, if one already knows HTML. Now, if one’s using some sort of “framework”, rather than iterating from scratch - then I could agree - but then one has to blame the framework, not the language.

Too many people introduce unnecessary complexity, flinging on framework, after framework, when their time would be better served, learning CSS from first principles.

Re: "CSS is dramatically more difficult than learning assembly language" [audio]

#99

Advanced results require advanced skills. CSS is one of my favorite languages. And the only way I can consider CSS to be difficult is if you have no experience with HTML. If you try to do HTML by hand, then doing CSS by hand on top of HTML by hand is really easy and wonderful. And this is truly where you gain the fundamental framework for "getting CSS".

I have yet to find a frontender (and I have worked with 100s over the past 30 years) that can do any significant css without trying it out in a browser; if there is something off or needs to change on the frontend, very often the most experienced senior frontender can guess (and often a little bit right) what it is but to actually fix it they have to try a few times. To me (someone who likes logic) that is a sign it’…

It seems like you're not comparing apples to apples. Investigating someone else's code to alter it is always going to be harder than writing new code, even on paper in several languages.

I do think that CSS has enough footguns to say that arbitrary CSS is not very good; well-written CSS is a very small subset of CSS in general. It joins many other languages in that regard-- C, C++, Javascript, PHP, Bash, the list goes on and on. As in all of those languages and more, with some basic familiarity it's not hard to sling some fresh code together and have it do what you want. Making it scale maintainably is the hard part.

(For my 2 cents on the matter, the way to write Good CSS(tm) is using CSS modules to limit scope, using flexbox or grid for all layout, and being rigorous about creating stacking contexts when you need to modify z order. Application of these three rules has made my life as a senior frontend engineer generally quite easy.)

Re: "CSS is dramatically more difficult than learning assembly language" [audio]

#100

slightly OT but can someone recommend how to learn CSS in 2023 for a backend web developer, who 30ish years ago grokked mainframe Assembly reasonably well (and since then developed in c, php, python, ruby, bash, etc etc)? Can/do I start with tailwind? Do I start with old-school CSS or jump straight into flexbox? Do I need to care and learn about BEM, Sass, etc? Do I start with an empty page and build it? Do I need to…

https://web.dev/learn/css

I haven't read each section, but just from the outline this appears to cover everything you need to know to do 99.9% of modern CSS development. (And then some, for good measure... I don't think I've ever used blend modes, for instance.)
Post reply on HN