Background Colors and Textures

Class notes for April 1, 1996
Professor John M. McCann

There is a standard structure for HTML documents that we have been ignoring. I will illustrate this structure with the following image taken from the Hotdog HTML editor that I use on a daily basis. When you open a new document in Hotdog, the page contains a set of document tags:

The beginning HTML tag specifies that what follows is HTML material. The HEAD tag specifies a header section that can contain the TITLE tag and other tags. The BODY section contains the types of tags and material that we use in this course. We can use the BODY tag attributes to specify colors and textures for the page.

The following is an example of a body tag that was used at another site. The background for this page, you are now reading, was produced by this same body tag.

The BGSTART and BGEND attributes appear to be optional. bgcolor specifies the background color using a hex code. You can use a color chart to determine the appropriate code. Notice that we have a black background (specified via the #000000 code) with yellow type and light blue links. background specifies an image file that forms the background for the page. Since the file "backgrounds/2.jpg" is not present at my Web site, the background attribute is ignored and this page does not have a background.

Any gif or jpg file can be used as the background, as illustrated with a picture I took and touched up at CyberSmith's Cafe in Harvard Square. This is obviously not a good choice for a background image. A nice image of batman makes a better background.

A much more common approach is to produce a textured background with an image that is a texture. There are a number of Web sites that provide background textures, including a site at SFSU. Click around at this site to see the assortment of textures. The author gives permission to download a texture to your computer, and even instructions about how to do the download.