10 things I learned from Lynda’s “CSS For Developers” course

Here’s a link to the full course.

I took this class to refresh myself on CSS concepts, since I’m learning how to program.

Here are 10 random things I learned. As refresher, I’ve been writing down “10 things” for books I’ve finished, so I may as well extend that concept.

1. An ex unit is like the em, but for height. It’s usually half of an em

2. Internet Explorer will often render pages not to your liking if you don’t include an explicit doctype declaration

3. Pseudo-selectors allow you to change things like the style of a link’s state (eg, a:hover or a:visited)

4. There’s RGB, and then there’s RGBA (A = Alpha, for transparency); some browsers may not support this

5. Three positioning models: absolute/relative (where “relative” is the anchor element for “absolute” positioning…it’s odd); float (eg: float: left); fixed (relative to the viewer’s screen, not a page’s elements)

6. To layer elements in the 3rd dimension (where x = horizontal dimension and y = vertical dimension), you use z-index (eg, z-index: -1; for example, this could position an image behind a paragraph of text)

7. If you expect people will frequently print out your content, you should create a separate print-ready stylesheet using a tag like the following:

<link rel=”stylesheet” type=”text/css” media=”print” href=”print.css” />

And some suggested best practices:

8. Always use <span></span> for inline style changes

9. Use comments frequently, to organize your CSS (eg, as section headers), for clarification, etc

10. Use multiple style sheets on more complex pages for better organization, cleaner code, etc

Hi! I write about habits and spirituality and random whatevers. Click here to see the daily habits that I track. Find me on Twitter @kgao.