I've been paying more attention to my website recently. I've been asking why it exists, what I want it to look like, and other such questions.

Anyhow, as I rewrite my CSS, I've begun to realize how poorly I use it as a language. My process for writing it consists mostly of trial-and-error, without any idea of what I'm doing. That makes it hard to rewrite the code, since there's no organization or logic.

An Analogy

I guess my point is that writing CSS is kinda like typing on a keyboard.[1] Some typists don't have the layout memorized. This group looks down at the keyboard when typing, then up at the screen to check for accuracy, and then down again. Other typists know the layout perfectly well, and focus their eyes on the screen at all times.

In the same fashion, some developers try CSS rules until they get what they want. The conversation goes something like this: Let's try float: left. Nope. How about flexbox? Ah, there we go. But it's not wrapping (sigh).

Other developers know why each rule does what it does. They don't need to see the browser as often. There's no "guess and check". This second group transcends methodologies like BEM, and opinionated questions like "how to order your rules".

An Ideal

When you stop pushing divs across the screen, you start making a website. I want to stop pushing divs. Websites are coffee makers, and I want to brew some coffee. Currently, though, I don’t understand CSS. I just write it.

  1. Not literally. I mean, I suppose you are typing on a keyboard. Unless your name is Josh Comeau, and you can code without using your hands. But, I digress. ↩︎