HTML and CSS Reference
Q: Does every <p> element have the same
style? Or can I, say, make two paragraphs different
A: The CSS rules we've used so far define the style
for all paragraphs, but CSS is very expressive: it can
be used to specify styles in lots of different ways, for
lots of different elements — even subsets of elements.
You'll see how to make paragraphs two different colors
later in this chapter.
Q: How do I know what properties I can set on
A: Well, there are lots of properties that can be
set on elements, certainly more than you'd want to
memorize, in any case. You're going to get quite
familiar with the more common properties in the next
few chapters. You'll probably also want to find a good
CSS reference. There are plenty of references online,
and O'Reilly's CSS Pocket Reference is a great little
Q: Remind me why I'm defining all this style in
a separate language, rather than in HTML. Since
the elements are written in HTML, wouldn't it be
easier just to write style in HTML, too?
A: You're going to start to see some big advantages
to using CSS in the next few chapters. But here's a
quick answer: CSS really is better suited for specifying
style information than HTML. Using just a small bit of
CSS, you can create fairly large effects on the style
of your HTML. You're also going to see that CSS is a
much better way to handle styles for multiple pages.
You'll see how that works later in this chapter.
Say you have an <em> element
inside a paragraph. If you change the
background color of the paragraph, do
you think you also have to change the
background of the <em> element so it
matches the background color of the