Chapter Nine: CSS Basics

In this chapter, we’ll move swiftly through the rudiments of CSS grammar, cover a few not-so-basic ideas, and end by describing a CSS design method. Even if you’re familiar with CSS, you might want to stick around.

CSS Overview

The W3C rather crisply defines CSS as “a simple mechanism for adding style (for example, fonts, colors, spacing) to web documents” (www.w3.org/Style/CSS). A few details omitted from that summary are worth noting:

• CSS is a standard layout language for the web—one that controls colors, typography, and the size and placement of elements and images.

• Although precise and powerful, CSS is easy to author by hand, as this chapter will show. Indeed, CSS framers Håkon Lie and Bert ...

Get Designing with Web Standards, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.