Inside JavaScript

Here are the style properties you use to set color and backgrounds:

  • color specifies the foreground color.

  • background-color specifies the background color.

  • background-image specifies a background image.

  • background-repeat specifies whether the background image should be tiled.

  • background-attachment specifies whether the background scrolls with the rest of the document.

  • background-position specifies the initial position of the background.

Here's an example. In this case, I'm styling both the background and foreground colors of a document:

(Listing 21-06.html on the web site)

<HTML> <HEAD> <TITLE> Color Styles </TITLE> </HEAD> <BODY > <H1> Color Styles </H1> <DIV > Using Color Styles! </DIV> </BODY> </HTML>

You can see the results in Figure 21.2.

Figure 21.2. Using color styles.

Категории