Learning about CSS

by Jason Preston on February 29, 2008

If you think any of this gibberish looks interesting, you should poke around and subscribe to my RSS feed to keep up with new content.

I recently picked up a copy of Eric Meyer’s CSS: The Definitive Guide, in order to edumicate myself semi-officially in the mysterious ways of CSS.

As I do with most things, I’ve been teaching myself CSS by dissecting the work of others, examining it, and then like a giant with a teacup, carefully destroying it. I figured it was about time I learn some of the actual rules.

I’ve gone through the first two chapters so far, and OH BOY do I know jack shit about CSS.

For example, in CSS you do things like this:

#monkey {color: blue; margin-left: 10px; margin-top: 10px;}

As far as I knew, this meant that any div with the property id="monkey" would have blue text, and 10px margins on the top and left.

In most browsers, that is actually the case. What I didn’t know is that “id” is supposed to be unique. In other words, the style applies to the first instance, but not to subsequent instances (most browsers ignore this — how was I to know?)

I also didn’t know that #monkey is shorthand for *#monkey, which means “anything with id=’monkey’.” So it could be a div, an em, practically anything (but only the first instance).

Basically I had no concept of selectors. Now it’s time to figure out what else I have no concept of.

On the other hand, I’m having a lot of fun learning this new stuff, and I’m excited to put it to use. I think I did a decent job of styling the new Sentimine portal page. Next stop: fixing all my errant legacy wordpress theme code throughout all of our blogs!

Tagtastic: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • ThisNext
  • Wists
  • Netscape
  • NewsVine
  • Reddit
  • StumbleUpon
  • TailRank
  • Technorati