Live data from Hacker News

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

news.ycombinator.com

151–160 of 358 posts

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

#151
I’m currently writing my second ebook on CSS, and you are exactly the type of person I want to help.

The first thing you need to understand is how a page behaves when it’s _unstyled_. I mean when you haven’t implemented your own CSS. It turns out that there is no such thing as an unstyled page because the browser comes with its own default CSS.

At that point you have to get a feel of how each type of element (block, inline, table, list…) is rendered. Turns out that you’ll that if you understand block and inline elements, you’re halfway there (that’s actually what my second chapter will cover).

When I started writing CSS, I wrote it by hand in Notepad++, line by line, with no autocomplete. I think you need to go through that process to understand each property first, and learn what it does.

Send me an email and I’ll send you a draft of my book. If I can solve your problems, it’ll mean I’m on the right path.

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

#152
CSS is best served along with HTML. I believe that one should understand the intricacies of HTML — the hierarchies in which one writes and the ability to think far ahead on how they will be treated on a page, container(s) or re-purposed by a templating engine.

HTML and CSS for that matter are very easy to start off. After a while, many begin to believe they are done; when actually, they are just starting off. It is one of those whom many would choose to ignore or use other tools to just “get it done”. A good designer, who can code, can do magic if s/he can go deep into HTML and CSS.

For instance, when developing interface designs for a complex or a big enough system, I advise my team to think of each and every block as something that is liquid enough to be thrown inside a container of varying possibilities. Test with few default container sizes but leave enough room that this can be just thrown in anywhere and will adapt to that containing block. This has become easier in React and other frameworks that encourage design thinking in modular blocks of designs.

Pre-processors, post-processors do help but one needs to be clear of the underlying philosophies and methodologies of CSS to appreciate these helper tools. Mastering these tool can then help work faster, smarter.

CSS is learned through practice, knowing the quarks and being able to make it work for 80%+ of the use cases. Break-up into smaller chunks of simpler blocks, have a styleguide-ish setup for yourself (if you don’t have one for your team), use development tools as guard rails. Finally, have a good post development workflow to get the final juice — task automation that removes un-used CSS, et al.

Imagine being able to get a column’s background color to extend equally all the way down the page in a 3-Column Faux Layout in 2003 (sometime around 2002-2004). ;-)

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

#153

My frustrations w/ CSS stemmed from not having respect for the complexity of the problem that CSS solved. I went into it w/ the same attitude of "hey, just center this thing", and didn't really get anywhere. These days I have accepted that CSS is a tool for pros, which I am not.

> hey, just center this thing Step 1: On your container div... display:flex; justify-content:center; align-items:center; Step 2: There is no step 2.

this won't work on bootstrap elements

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

#155
post #142

Earlier quoted context omitted.

CSS is not a real constraint language. If it really were a constraint language, it would be better. There's no constraint solver. Just a bunch of rules applied sequentially. I'd like to have a real constraint system, like the one in Autodesk Inventor sketch mode. You select two things and apply a constraint - parallel, tangent, horizontal, collinear, etc - and the constraint system enforces those constraints. The lay…

> Amusingly, tables came back. But they're called "layout tables" now, to avoid embarrassment. I'm not really sure what you're talking about. Tables were bad because they were too rigid and weren't designed for layout purposes; they do still get used when you want to display an actual table. Maybe you meant CSS Grid? > Trying to do 2D layout with 1D constructs (the "float" and "clear" era) was just silly. The float e…

> Tables were bad because they were too rigid and weren't designed for layout purposes; they do still get used when you want to display an actual table.

And when you have to implement a email design someone gave you who think it’s more important to have it look a certain way then to implement it reliable.

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

#156
I was like this 5 years ago. It's trite and no one wants to hear it, but the basics go a long, long way.

All of that stuff you hear about in front-end interviews ( like the box-model and relative vs absolute positioning ) comes in handy.

I do admit that pre-flexbox CSS did require some wizardry and hacks here and there. I think "modern CSS" is quite enjoyable and we're able to enjoy a time where we no longer need CSS frameworks to do all the "hard work"

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

#157

I was like this 5 years ago. It's trite and no one wants to hear it, but the basics go a long, long way. All of that stuff you hear about in front-end interviews ( like the box-model and relative vs absolute positioning ) comes in handy. I do admit that pre-flexbox CSS did require some wizardry and hacks here and there. I think "modern CSS" is quite enjoyable and we're able to enjoy a time where we no longer need CSS…

I remember times of supporting x-platform css for IE5/5.5/6 and FF1. IMO everything that people complaining right now is nothing with the Wild West that was back then.

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

#158
I'm also a seasoned back end developer. It took me 3 years to become a beginner at CSS, and two more to feel like I could finally style an arbitrary front end at an intermediate skill level. This is in comparison to 1 year to master javascript and another year to "get" React top to bottom. CSS was even harder to learn than ansible or clustered mongodb at scale.

I suspect it's a neurological difference. I've seen masters of CSS struggle with basic operational computing concepts that feel obvious to back end developers.

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

#159
post #11

I actually prefer coding CSS from scratch. Color schemes and making things look nice IS hard, for my previous and current projects I had to get feedback from friends, family, end users, graphic designers, etc. UX is hard, it's a different field than programming, but there is a method, research, and science behind it. Here's a good resource for UX: https://goodui.org And here is one for color theory: https://uxplanet.…

Same here. I recommend to avoid bloated kitchen sink frameworks like Bootstrap and Foundation unless you don't plan to do any customizations at all and only include the parts you actually use. Otherwise you'll realize that you're actually fighting the framework by trying to override it.

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

#160
First learn design, then learn the tools(CSS). Preferably using a book that has nothing to do with web design. Problem with most developers is that we only learn the tool and forget to learn design. To understand how to properly mix colours, you need to study colour theory. To understand how to use the right fonts, spacing etc, you need to study typography. Also learn about image types. I don't understand why most web design books want to dive straight into CSS before design.

After that, you need hours and hours of practice in order to be good at it. We learn by doing.

Post reply on HN