CSS Tutorial - Example of Background-Image Attribute

Back to Tutorial Page

The Html code for the body background-image property on this page looks like this:
<STYLE>
<!--
BODY
{background-image: url("til05v16.jpg");
background-color:#CC99FF;
font-family: Arial, Verdana, Helvetica, sans-serif;
font-size: 14pt;
color:#000000;}
TABLE.special {background-image:url("til05v15.jpg");}
.bgc  {background-color:#66FFCC}
-->
</STYLE>
If you prefer not to set the background-image as an embedded style (as show above), you can set it by using an inline style which looks like this:
<BODY STYLE="background-image: url("til05v16.jpg");">
The Html code for the table below looks like this:

<TABLE WIDTH=300 BORDER=1 ALIGN=CENTER CLASS="special">

Cell 1, Row 1 Cell 2, Row 1
Cell 1, Row 2 Cell 2, Row 2
Note: the reason for using TABLE.special Class is because I do not want all my tables in this document to have a background image. I only want this table to have a background image.
Note:Cell 2, Row 2 has its background changed by applying the "bgc" rule. Html code looks like this:

<TD CLASS="bgc">Cell 2, Row 2</TD>



Back Page 1 of 1  
Page added on 09-30-2001