|
To access the contents, click the chapter and section titles.
HTML 4.0 Sourcebook
Background Images and ColorsAs discussed in Chapters 2 and 6, most browsers support background images via a BACKGROUND attribute to the HTML BODY, D, or TH elements. Background images can use any of the supported image formats. However, care must be taken when selecting a background, so that it does not impair the readability of the actual content. In addition to a BACKGROUND, an author can specify the background color for the document using the BGCOLOR attribute. In both cases, here are some important design points:
BGCOLOR values can be either RGB hexadecimal codes (e.g., #FF0000 for the color red) or a color name chosen from a defined list of names. Go to Appendix F on the companion Web site for a list of all the defined color names and their RGB hex code equivalents. The references at the end of this chapter list sites on the Web that archive useful background images. Additional information about backgrounds is found at: This site also provides links to databases containing color and background examples. Active Images and ImagemapsActive images, clickable images, imagemapswhatever they are calledyou have certainly seen them, and most authors want to use them. An active image means that users can click their mouse pointer on top of the image and have different things happen, depending on where they clicked. For example, the active image could be a city map, such that clicking on different locations returns information about particular buildings, transportation routes, or historic monuments. There are two ways of implementing active images. The original way, known as imagemapping, stores information about the active image on an HTTP server. When the user clicks on the image, the Web browser measures the location of the click, and sends this information to an HTTP server. The server uses these coordinates to determine which information to return to the browser. This requires special processing by both the client and the HTTP server. First, the client must be able to measure the coordinates of the mouse pointer when the user clicks on the active image, and must be configured to send this information to an HTTP server for interpretation and action. Second, there must be resource on the serveroften a gateway programcapable of interpreting this coordinate data. Finally, there must be a database on the server relating, for each image, the click coordinates to the appropriate URL. This means that the imagemap designer must take the image, mark out the desired regions, link these regions to particular URLs, and store this information in an imagemap database. The second approach, called client-side imagemapping, includes the imagemap database within the HTML document. This eliminates the need to contact a server and offers many substantial advantages. However, not all browsers support this approach. Fortunately, you can use both methods for the same imagemapped image: If the browser understands client-side imagemapping, it will use the map within the document, and if it does not, it will access the HTTP server instead.
Things to Think About Before StartingBefore you get carried away with active images, stop and think about your audience. First recall that some users will not be able to view your active images, because they are using a text-only browser, such as lynx, or because they have disabled image loading because of a slow network connection (quite common). Consequently, you should make the image files as small as possible, and you might also wish to provide a text-only alternative for accessing the same information. For example, your document can have a line of text explaining what the image does and offering a hypertext link to a page providing a text-only approach. In particular, every active image element must have an ALT text string to explain the images purpose and to explain what to do if the image is not visible. Server-based Imagemap Active ImagesYou must do two things to mark up a server-side imagemapped image. First, add the ISMAP attribute to the IMG element, which this tells the browser that this is an active image. Second, surround the IMG element with a hypertext anchor that points to the program on the server that will process the selected coordinate data. Thus, the minimal HTML markup (the extra markup for the active image is shown in boldface) is: <A HREF=<http://some.site.edu/cgi-bin/imagemap/my_database>><IMG SRC=image.gif ALT=[Imagemap: The author, and a Large, Hairy Llama - an ACTIVE image] ISMAP></A> which tells the browser that this is an active image and that, when a user clicks inside the image, the coordinates of the click should be sent to the server and to the program imagemap at the given URL. The coordinate information is sent to this URL using the HTTP GET method. Thus, once the image is selected, the accessed URL will look like <http://some.site.edu/cgi-bin/imagemap/my_databasex,y>
|
Products | Contact Us | About Us | Privacy | Ad Info | Home
Use of this site is subject to certain Terms & Conditions, Copyright © 1996-2000 EarthWeb Inc. All rights reserved. Reproduction whole or in part in any form or medium without express written permission of EarthWeb is prohibited. Read EarthWeb's privacy statement. |