-->
Previous | Table of Contents | Next |
One feature that has made the Web so popular is its capability to incorporate graphics and text in a simple format. HTML makes it easy to insert graphics into your documents. Before you start putting all sorts of graphic images into documents, though, remember that many people access the Web via low-speed telephone lines and that graphics can take a long time to transfer at these rates. Also, some people use text-based browsers, such as Lynx, which cant display graphics at all. You should make sure that someone can navigate your Web documents easily, even if they have graphics turned off or if their browser doesnt support graphics. In a moment, youll learn a technique for checking for graphics support.
You can use graphics in your HTML documents in two ways: by using hypertext links or by using inline images.
As mentioned earlier, you need to make your Web pages usable by browsers that dont support graphics. To do this, you should provide some text reference any time you use a graphic image. HTML provides a way for you to define some text to be displayed if a browser cant display a graphic image. The ALT=text about the graphic attribute defines some alternate text that will be displayed when the graphic cant be displayed.
An example might help pull this all together. Listing 32.8 is a section of HTML that displays an inline GIF image. If a browser cant display the image, a description of the image is shown instead.
Listing 32.8 Inserting a Graphic into Your Script
<HTML> <HEAD> <TITLE>Image example</TITLE> </HEAD> <BODY> <H2>Images</H2> <P> <P> <IMG src=venus.jpg align=right height=160 width=82 alt=Statue of Aphrodite> <UL> <LI>Statue of Aphrodite, known as the Venus de Milo. <LI>Carved out of marble in Greece, circa 100 B.C. <LI>Currently in the Louvre in Paris <LI>Part of the Louvres Greek, Etruscan and Roman Antiquities Collection </UL> <HR> To go to the Louvres web site click <A HREF=http://mistral.culture.fr/louvre/louvrea.htm>HERE</A> </BODY> </HTML>
Figure 32.9 shows how this page is displayed in Netscape. You can see how different elements (heading, a list, horizontal line, graphic, and a link) combine to make up a page.
FIG. 32.9 An inline graphic displayed in Netscape.
You can combine graphic images and anchors to create graphic hypertext links as well. Simply surround the <IMG> tag with anchor tags that define which document to load. A picture serves as a hypertext link to another HTML document in the following example:
Click the picture to find out more about this statue. <A HREF=statue.html><IMG SRC=statue.gif ALIGN=BOTTOM ALT=[Photo of statue]> </A>
This chapter introduces you to basic HTML and how to create a Web page. You learned how to use tags, which provide commands to a Web browser, and how to use attributes and URLs, which provide details for the commands. Many HTML guides are available on the Internet that cover everything from syntax to design. Use one of the many search engines to look up HTML topics that interest you.
ON THE WEB:
A good starting point for ideas is Yahoos listings for HTML:
You can find out more about the World Wide Web and the Internet in Chapter 31, Surfing the Internet with the World Wide Web, which introduces you to the Web and how to search it.
Previous | Table of Contents | Next |