By Alex Zelenskiy

RE: Announcing The Oxymoron CSS Framework

Hi Zed,

Just read your post on CSS. I do agree that it is often a very frustrating language to use, but I think you are being somewhat unfair about how much it sucks. Or maybe just how much it sucks in context.

CSS has a very steep learning curve, and is difficult to work with (in my opinion) for a couple reasons:

  1. CSS/HTML behavior is not consistent across browsers. Every browsers enjoys rendering websites in it's own special way and there is nothing you can do to avoid it except just forgetting that some ways of doing stuff exist and never using them again. In addition, there are a coupe things that ALL browsers do that break how the specification is supposed to work (z-index nesting, for example) because doing it the right way is hard.
  2. Like you mentioned, everyone relies on tools like firebug to figure out why something is on the left and not centered. This gets better with experience, but that's not really the point.
  3. It is very easy to build small sites with css, but incredibly difficult to build systems of css rules that can handle all of the style needs of a large site concisely. Few people can build these systems, and even after they are built they are fascinatingly easy to completely ruin.

These are all signs that css, much like most web stuff, is very immature. In my opinion, though, that also makes it exciting. There are a lot of problems that still have to be solved with CSS/HTML.

Here are how some people are trying to fix some of the issues you brought up in your post. I know it was a rant and you may be aware of some/all of these, but, then again, some of these might be new.

CSS does not have variables It does not, but there are a couple of ways to deal with this.

One is through a meta-language like sass (http://sass-lang.com/ , now in classic css and haml flavors) that provides you with the ability to use variables, mix-ins, and nesting to your heart's content. It's really pretty cool, and a lot of people swear by it. Unfortunately, it tends to bring out some of the worst coding habits in a small subset of people who have not coded very much plain css before.

The other way is that you use a css class in a lot of situations where you would want to use a variable. Does the text in 15 different divs need to be 14px tall and vibrant orange? Don't put that code in all 15 div classes. Make a class for it and then give those divs that class.

The Cascading part of CSS sucks Only when used incorrectly. Having huge chains of IDs and subclasses to overwrite slightly shorter chains of the same thing is not how CSS should be written. This feature of CSS, despite taking up the only "C" in the name", is really bad for code legibility and maintenance.

Good css is full of classes that do the exact same thing no matter where you put them in the dom.

A great resource to check out to avoid a lot of this insanity is Object-Oriented CSS, and the stuff by the person who came up with it: http://www.stubbornella.org/content/ . Nicole Sullivan is a pretty classy lady, and is doing a good job trying to educate people about a good way to do a lot of this stuff.

"why the fuck we struggled for decades with something so fucking weird" Because there is a lot of really cool stuff that you get to do, and it always feels like you're coding in the middle of some fucking jungle. This may not appeal to some people.

The dude who made the pac-man google logo said this:

"Something else that took me a while to internalize: you have to accept that with Web development, anything that’s worth anything will be a hack. Not just prototyping; production code as well. That’s hard to swallow when you’re used to proper, clean, sterile programming. I’d go as far as to say if you’re working on something and you never think “what I did here is terrible; hopefully one day there will be a nicer, better way to do it,” you’ve already fallen behind."

In this interview: http://ajaxian.com/archives/web-ninja-interview-marcin-wichary-creator-of-google-pacman-logo-html5-slide-deck-and-more

CSS Books are shit They are, and perhaps a greater percent of them are shit than books written on other programming topics. Web Development a very visible field of programming, so there is going to be a lot of hack writing that tries to make money off of people who want to make websites for their dogs.

Actually good books: http://www.amazon.com/exec/obidos/tg/detail/-/0321616952/jeffreyzeldmanprA/ http://books.alistapart.com/

CSS Naming is pretty much the worst thing ever Uhhh, yeah. Yeah it is. I use an editor that auto-completes all of the css properties.

Anyway, This is the gross last part of the email where I tell you that I really admire your work and your writing.

-- Sincerely,

Aleksandr Zelenskiy @cLowbrow