Need help with background color for blocks of text

This may be one of those things that has little practical value, but since it’s been presented to me I have to know how to do it correctly.

I’m working my way through HTML, XHTML and CSS for Dummies. On pp 163-164, it states:

"You can apply a background color to a block of text - for example, a paragraph - just like you define a background color for the entire page.

You use ‘background’ as a shorthand property for all individual background properties or ‘background-color’ to set just the color, like this:

selector {background: value value value;}"

For practice, I decided to try coloring the five paragraphs in my document 5 different colors. I thought from the above language that I could do this. So I put the following in my document:

p {background: lime aqua fuchsia silver teal;}

The background remained white. But, when I changed it to this:

p {background: lime;}

all the paragraphs changed to lime while the headers and general background remained white.

Did I misunderstand the book? Did the book get something wrong? Did I make a mistake in my code? Please let me know. Thanks!

I can’t seem to attach the file, so here is the code:

<!DOCTYPE html PUBLIC “-//W#C//DTD XHTML 1.0 Transitional//EN”
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=“http://www.w3.org/1999/xhtml”>
<head>
<title>Chapter 10 Practice</title>
<meta http-equiv=“Content-Type” content=“text/html; charset=ISO-8859-1” />
<style type=“text/css”>
body {color: olive; font-family: Verdana, sans-serif; font-size: 85%}
hr {text-align: center;}
h1 {color: #808000}
p {background: lime aqua fuchsia silver teal;}
a:link {color: #FF0000;}
a:visited {color: green;}
a:focus {color: blue;}
a:hover {color: purple;}
a:active {color: black;}
</style>

<body>
<h1>This is Heading 1</h1>

&lt;p&gt;This is a paragraph. It's just something I threw together. This sentence
contains &lt;a href="http://www.w3.org/"&gt;a link&lt;/a&gt; to W3C, which you have
probably visited. This sentence contains a link to &lt;a href=
"http://www.foo.net/"&gt;someplace else&lt;/a&gt;. This is &lt;a href=
"http://www.htmlhelp.com/" class="offsite"&gt;an offsite link&lt;/a&gt;. In the
beginning was the word. And the word wrapped. I'll be looking soon for
opportunities to style this text. In the meantime it will do merely to
occupy space.&lt;/p&gt;

&lt;h2&gt;I'm Heading 2&lt;/h2&gt;

&lt;p&gt;This is a paragraph. It's just something I threw together. In the
beginning was the word. And the word wrapped. I'll be looking soon for
opportunities to style this text. In the meantime it will do merely to
occupy space.&lt;/p&gt;

&lt;h3&gt;Heading 3 here&lt;/h3&gt;

&lt;p&gt;This is a paragraph. It's just something I threw together. In the
beginning was the word. And the word wrapped. I'll be looking soon for
opportunities to style this text. In the meantime it will do merely to
occupy space.&lt;/p&gt;

&lt;h4&gt;Heading 4: the final insult&lt;/h4&gt;

&lt;p&gt;This is a paragraph. It's just something I threw together. In the
beginning was the word. And the word wrapped. I'll be looking soon for
opportunities to style this text. In the meantime it will do merely to
occupy space.&lt;/p&gt;

&lt;h5&gt;Heading 5 I Am said Sam. In the Mosaic browser default stylesheet, I'm
one step smaller than normal paragraph text. In the Core Style Project, I
am still one step larger.&lt;/h5&gt;

&lt;p&gt;This is a paragraph. It's just something I threw together. In the
beginning was the word. And the word wrapped. I'll be looking soon for
opportunities to style this text. In the meantime it will do merely to
occupy space.&lt;/p&gt;

&lt;h6&gt;Heading 6, extended to produce a line break, so as to be able to
determine line-height. This ought to do it, what? In the Mosaic browser
default stylesheet, I'm two steps smaller than normal paragraph text
(perverse!). In the Core Style Project, I am the same size.&lt;/h6&gt;

<hr />
</body>
</html>

You can’t define multiple different paragraphs with one selector.

The background shorthand property sets all the background properties in one declaration.

The properties that can be set, are (in order): background-color, background-image, background-repeat, background-attachment, and background-position.

If you want different colors for your paragraphs, you will need to define a class for each paragraph such as:

p.lime{background-color: lime;}
p.orange{background-color: orange;}

Then your html:

<p class="lime">Your lime text here</p>
<p class="orange">Your orange text here</p>