Chapter 2
Chapter 2: Getting Results with CSS ............................................................................
In This Chapter
Starting from scratch
Introducing selectors and grouping
Creating all-purpose properties
Managing ID selectors
Cascading style sheets
Visualizing specificity
Exploring inheritance
T
his chapter introduces several somewhat theoretical concepts central to
understanding CSS. But rather than tire you with boring, abstract expla-
nations of boring, abstract concepts such as inheritanceand specificity, I’m
going to entertain you with brief examples and a clever, painless presentation.
You’ll never know what hit you. Nonetheless, after you try the examples in
this chapter, you’ll have an almost subconscious understanding of the main
theoretical concepts behind CSS.
So, roll up your sleeves and get ready to see how fun CSS can be. Never mind
that you’re also find out about some CSS theory at the same time. The theory
comes in through the back door while you’re otherwise amused by the inter-
esting examples.
Starting from Scratch ....................................................................................
You can write CSS using any plain text editor. Like XML and other contempo-
rary computer languages derived from HTML, CSS makes no attempt to
create some strange, specialized code language that cannot be easily written
or read as simple, English text.
Of course, specialized CSS editors can assist you in various ways, particularly
if you want to build heavy-duty, complicated Web sites. But, for now, I start off
with very simple examples of CSS in action. And to create these examples, you
use nothing more sophisticated than Windows’s down-to-earth little Notepad.