Chapter 3. TIPS

EVERYONE CAN USE a few good tips to get through life. Two of my favorites are "always favor a small house on a nice street over a big house on a lousy street" and "don't eat lead." And so it is in CSS: A few simple words to the wise can put you right in no time flat.

In this chapter, we discuss the importance of ordering of values, proper uses of unitless values, ways to make elements disappear, a method for controlling border appearance, list tricks, print-style development, and much more.


This might be old hat to you. You might be wondering why I would waste precious ink and tree pulp on so obvious a topic. And yet, how often do you actually validate? Once at the end of the project, or all the way through?

While I'm not telling you to validate every time you hit "Save" on the document you're writing, it is a good idea to get into the habit of validating at regular intervals as you go through a page build. That way, you catch problems before they infect the whole page structure.

There are a few good validators out there for both HTML and CSS. In the HTML sphere, probably the most widely used validator is the one provided by the W3C itself and located at (see Figure 3-1). Its CSS-centric cousin, sited at, is equally popular.

The W3C's HTML validator.

Figure 3.1. The W3C's HTML validator.

What if you're stuck developing behind a firewall, or do ...

Get Smashing CSS: Professional Techniques for Modern Layout now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.