Adding background-image


Adding background-image

The background-image property is used to add a background image to the <body> element.

Values for the background-image property are either a url (to specify the image) or none (when no image is used).

For this lesson, you will use url(chapter6.jpg). The image path can be written with or without quotation marks. The background-image code is shown in Listing 6.3. The results can be seen in Figure 6.1.

Listing 6.3. CSS Code Styling the <body> Element with a Background Image
body {     background-image: url(chapter6.jpg); } 

Figure 6.1. Screenshot of styled <body>.


Background Images and Internet Explorer 5 for Macintosh

Internet Explorer 5 for Macintosh will not render background-images if quotations are used around image paths. Because quotation marks are not needed, it is simpler and safer to leave them out.






Sams Teach Yourself CSS in 10 Minutes
Sams Teach Yourself CSS in 10 Minutes
ISBN: 0672327457
EAN: 2147483647
Year: 2005
Pages: 234
Authors: Russ Weakley

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