Live data from Hacker News

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

news.ycombinator.com

51–60 of 358 posts

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

#51
I feel similar but with the functional languages you mentioned. But I know they are not special or dark art, just tools I haven't spent enough time to master because I lacked motivation.

As others mentioned the complexity of CSS makes it very powerful, thus complex. Don't underestimate it as some low level icing.

I would start here with CSS:

https://www.youtube.com/watch?v=I9XRrlOOazo&list=PL4cUxeGkcC...

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

#52
post #25

Earlier quoted context omitted.

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

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

Positioning is one thing, but CSS really shines in it's graphical abilities. Autolayout is fantastic, but have you tried writing the custom CoreGraphics code that is required to do anything outside of standard UIKit visuals? Not fun [0]. Being able to just type `background: linear-gradient(orange, green)` is a godsend compared to that stuff.

[0] https://github.com/amraboelela/myos.examples/blob/master/Cor...

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

#53
There's so much value to learning CSS and all it takes is time and practice. It's not an art but I think competent programmers are justifiably irritated when their skills don't apply to what is ostensibly just another language or syntax. They'll walk away when they realize it takes time to do things which ought to be simple like making a layout with some columns. But it's actually really fun after a while. And you're like a wizard to everyone that was just too lazy to learn it.

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

#54
> I have no idea which colors "go" with which ones, and pretty much all fonts look like the same for me.

Before going into web development, I wondered why some people were so picky about fonts when they all looked similar. I'm a little ashamed to admit that after 5 years, they still look somewhat similar.

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

#55
I have done a lot of backend and front-end coding over the years I've found CSS is complex just due to the sheer depth of detail, but not hard once you get the hang of the basics.

The key areas that will probably help you the most are flexbox and grids. These are modern things that will make your life in CSS 10x easier and more productive. With flexbox and grid it becomes trivial to do "hard" things like centering div's, full-height divs, footers etc etc. Use flexbox for laying things out in one dimension (e.g. "I want these related to appear in a row/column") and use grid for doing two dimensional layouts (e.g. "I want a bar across the top and bottom and then two columns in the middle"). Mix and match flexbox and grid (e.g. use flexbox inside of a grid area) and you've got 90% of the CSS done in my experience.

This guide for flexbox is awesome and spells it all out: https://css-tricks.com/snippets/css/a-guide-to-flexbox/ (although their site's visual design is the worst type of hideous garbage IMO, but I can forgive them that for the content)

The last 10% is fiddling around with colours and margins and font sizes etc. I'm no designer and rely on the UX and Visual Designer to tell me what colours/fonts/margins/etc to use, but regardless there is actually something very very satisfying about nailing the CSS and seeing something ugly transform into something really nice right before your eyes.

Also a final top tip is to get familiar with your dev tools in your browser of choice. Doing "real time" edits in the browser (in CSS but also DOM & JS too) then updating the code in your IDE is something I do frequently.

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

#56
It's easy-peasy once you get the general algorithm down:

1. Is there a Stack Overflow CSS snippet you can use as-is that solves your problem? Score!

2. No? Fiddle with random bits until it looks OK in your browser of choice (Chrome). Display: block and position: absolute are great time savers, slap that on most things.

3. Ship it! Onto the next feature!

Pro-tip: Pixels totally work and you should just stick to that everywhere. The browsers and device manufacturers have kindly taken the necessary steps to make it Just Work no matter what the medium.

In case you think I'm being sarcastic, only half. Nobody cares about your beautifully cascading, resolution independent em's and semantically beautifully structure. The whole thing will be run through an uglifier anyway and probably you should just have used JS for your runtime generated layout anyway if you have any kind of dynamic behavior.

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

#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 impossible to get decent rendering in every medium.

For the first years of CSS it was always easier to get a decent layout with tables than with it.

Finally all the CSS preprocessor, like saas and compass show how incomplete the technology really is.

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

#58
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.

Yeah, I hear this a bunch, and I can see why it'd feel that way. My standard response is that HTML/CSS simply didn't advance enough for a period of n years to make it easier, so it (for awhile) was arguably stuck in the late 90s/early-mid 2000s for layout concepts. The other response to you noted it's gotten easier lately too.

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

#59

CSS doesn't seem to be experiencing the same revival or energy that JS is still experiencing.

I'd disagree. There is a lot of new stuff to CSS making our lives HUGELY easier.

Classic example is CSS grids that is only recently starting to become ubiquitous in commonly used browsers, and the new units of measurement that go along with it like 'fr'. CSs does not feel stagnant to me, but is evolving I think... Perhaps not at the breakneck speed that JS libraries are, but then the core of ECMAScript is not going as fast as JS libraries either.

Post reply on HN