Live data from Hacker News

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

news.ycombinator.com

31–40 of 358 posts

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

#31

Earlier quoted context omitted.

Interesting, I'll have to read about that. This has totally not been my experience.

It works great... for a while. Then you end up wanting to tweak something here and there, start adding classes to things, and you realize you want to do something that requires changes to the DOM within a component and you're screwed. Or you ignore the fact that the right way would be modifying the DOM, use some hacky CSS to kludge it, and you start getting browser inconsistencies. Either way you end up stuck with 10…

Ah, that does make sense. Thanks for adding the examples -- I can totally see this happening. Guess I just haven't been bitten by that yet. Although, I do remember running some mass regex through the codebase to update class names when bootstrap changes something. Or, changing templates to use some new formatting. This can be nerve wracking.

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

#35
post #25

The thing with CSS is it's not a programming language. Progamming skills and CSS skills are almost completely orthogonal. It is simply a domain of practical knowledge that takes years and years of dealing with all the idiosyncracies, cross browser issues, and silly warts of historical legacy that come with it to master. That being said, it is without a doubt the most powerful and simplest layout tool in existence. Th…

> There's very very good reasons why practically all software nowadays has gone to HTML/CSS based UIs. One being that practically all software nowadays are webapps and there's no choice. For those that aren't webapps and whose GUI toolkit use CSS or something like CSS, it's probably to try to pull people that already have experience with webapps.

> and there's no choice

And this is the thing that many web developers miss. As they've begun to creep into the mobile and desktop space, intent on replacing native experiences with a continual barrage of non-native, bespoke apps, each with their own design, they've mistaken widespread availability with quality and utility — that HTML/CSS UIs are widely available is all to do with ubiquity and lessening an otherwise not-at-all steep learning curve, not technical merit.

Give me springs and struts, Autolayout, or PowerApp's style declarative positioning any day.

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

#36
post #5

>Incidentally, but very likely related, I always failed to have any glimpse into how design works. I have no idea which colors "go" with which ones, and pretty much all fonts look like the same for me. Yeah, you're not a designer. Note I'm not insulting you. :) CSS is very much like magazine or print layout IMO. If you're not used to that, it won't gel well. If you think of layout from a design perspective and _not_…

Can I be really predictable and give a "very different response"? Worked in magazines for years, still do a lot of print cartography, and I find CSS a completely different mindset to Illustrator or InDesign or Quark or whatever. It just feels like a weird outlier to me - not freeform enough to fulfil the "design" role, not programmatic enough to fulfil the "developer" role.

Same for me. As someone who's done a lot of layouts in InDesign, it seems to me that CSS is only starting to offer decent tools to reproduce that mental model (e.g. CSS grid). But somehow doing incredibly basic things such as positioning or aligning elements can still take inordinate amounts of time.

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

#37
I don't think CSS has anything to do with art, you usually have the design done already, you just need to put it together in a way that browsers can read, so it's just good ol' programming. Thing is that it's very easy to do a little things and tweaks in css, copy & paste snippets, so people jump to conclusions about css being easy - but then you discover that to really master css it requires a lot of lateral thinking and being able to look at the design and "see the matrix" behind it. It's like trying to figure out haskell and you come from C, you need some time for your brain to rewire how you think of problems. IMHO emphasis should be especially at a lot of learning by doing it, because experience is everything with css. So just give yourself some time, work on it and you'll figure it out...

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

#39
I held the same belief for a long time, but now I think that CSS isn't particularly in general, but can be very hard if a few core concepts are missing.

The main thing that personally made it really hard for me is that I totally forgot about the first thing you learn in CSS: _Cascading_ - Coming from saner languages, the concept that what is written at the bottom of the file has more meaning than what's at the top of the file, or even worse that the file that is included later in the HTML has more meaning (without much scoping, and sometimes unintuitive specificity of selectors), seemed bonkers to me (and still does to some degree). Once I internalized that, that solved 50% of my CSS problems.

Apart from my anecdotal stupidity, one of the best resources I found was "Learn CSS Layout the pedantic way"[0].

[0] http://book.mixu.net/css/

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

#40
post #22

> I can't center my divs properly. This is actually pretty simple, once you understand how "block" elements work. Block elements will always try to fill up the "available width" i.e., they stretch side ways. The sum of margin + its width must match the total width. Inline elements will fill up its parent block like text. So, a simple example - suppose you set a div's width to 100px, and margin to auto, then you will…

> This is actually pretty simple, once you understand how "block" elements work.

I disagree -- in this and every case where someone has told me that something is simple once you understand the fundamentals. Understanding how a tool works is completely different from understanding how to use it to accomplish a particular goal. One's a deconstructive process, and the other is a constructive process.

Post reply on HN