Web Design

(Nancy Kaufman) #1

109


CHAPTER

4


● When viewed in a browser,
the page now has the
specified background color.

1 In your editor, open a
document that contains an
embedded style sheet and an
existing body declaration.
2 Within the declaration, type
background-color:
#?;, replacing? with a
hexadecimal value for the
color you want to use.

Set a Background Color ..........................................


Y


ou can change the background color of your page or of elements within the page with the CSS
background-color property. The background color needs to contrast with the text color to

ensure readability. The default value of background-color is none, meaning that elements are


transparent. Almost every browser sets the background of the body to white, although if you want to


use a white background, you may want to expressly set the body’s background to white to safeguard


against browsers that might have a different default.


Set a Background Color


1


2

Free download pdf