Using Colors and Backgrounds


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 STYLE="background-color: cyan">  <H1>              Color Styles          </H1>  <DIV STYLE="color: red">   Using Color Styles!   </DIV>  </BODY>  </HTML> 

You can see the results in Figure 21.2.

Figure 21.2. Using color styles.

graphics/21fig02.gif



Inside Javascript
Inside JavaScript
ISBN: 0735712859
EAN: 2147483647
Year: 2005
Pages: 492
Authors: Steve Holzner

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net