Example: The BODY Element

Previous Next

Here is an example of a style sheet rule that applies to one specific HTML element; the BODY element.

body{
   background-color: #FFFFEE;  /* almost white */
   background-image: url(../images/CompanyLogo.gif);
   background-position: 98% 2%;
   background-repeat: no-repeat;
}

 

The background color is set to almost white, and a company logo image is displayed at the right top of each document.

This example also shows how declarations can be grouped, and how comments can be added. Each declaration must be terminated with a semicolon.