O'Reilly logo

Cascading Style Sheets (CSS) by Example by Steve Callihan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Setting Background Images

In HTML, the BODY element's BACKGROUND attribute is used to set a background image for a page. That attribute has been deprecated in HTML 4 and XHTML 1 in favor of using styles to achieve the same or better results. In CSS, the background-image property is used to specify an element to be displayed in an element's background. I've included a background image, paper.gif, with the example files that you can use to try this out, although you can substitute any lighter colored background image you want to use. To apply a background image to your page, edit your style sheet codes as shown here (see Figure 6.7):

body {  color: rgb(153,0,0); background-color: rgb(255,255,204); background-image:
						url("paper.gif"); }
Figure 6.7. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required