They Said It...
Today, the religion clauses of the First Amendment do not need to be fixed; they need to be followed.
HTML for Beginners |
Image TagsSubmitted by Syscrusher on Mon, 2005/06/06 - 23:36.
The <img> tag is used for inserting graphics (images) into your document. It is a relatively simple tag but interacts with other tags in complex ways, so it gets a page all to itself. Writing the TagThe basic format of <img> is this:
The <img> tag is a "standalone" tag in the sense that it can be used almost anywhere in the document body, and in the fact that it has no closing tag (there is no such tag as </img>). Let's look in detail at the attributes that can be specified along with the <img> tag:
Unfortunately, many web designers mistakenly use width and height to try to scale an image to make "thumbnails" in a photo album. Let's say you have an image file that is 400 pixels wide by 320 pixels high. You would like to thumbnail it at 100 pixels by 80 pixels -- a perfectly reasonable choice. The correct way is to actually have a smaller copy of the image on the server, created using a graphics editor program, that is downloaded as the thumbnail. Make the thumbnail part of a hyperlink to the actual image, so that the user can click on the thumbnail to see the entire image. Since your album may have dozens of photos on one page, this will dramatically reduce the download time of the page, and allows the user to select only the photos of particular interest for viewing at the larger (and slower) size. The incorrect way to use width and height is to have only the large image file, but to have the thumbnail <img> tag (which is still part of a link to the full image) specify width=100 height=80. The fact is that the entire large image still has to be downloaded -- for all the images on the page even if the user never selects the links to the larger version. The scaling down is done in the browser, after downloading. The page may work fast when you test it on your hard disk, but it will be slow as molasses over a modem! Using Images as HeadingsA common design technique is to have a colorful, fancy icon or logo at the top of a web page, often in place of the level-one heading that gives the page title. This is a good technique, but what do you do if the user's browser cannot draw the graphic? The answer is easy -- put the graphic inside an <h1> tag set! Here is an example:
Look carefully at what's inside the <h1>....</h1> area. There is no heading text except for what's in the alt attribute of the <img> tag itself. The way this works is that on a graphical browser (the usual case) the <h1> tag causes some extra whitespace to be generated (a good thing, because it leaves a clear space around the logo) but has no other effect because there is no text inside the tag. But on a browser that cannot display the graphic, the alt text prevails, and now it becomes the text inside the <h1> heading -- which behaves as usual. So every browser will now have "XYZ Company Incorporated" displayed in some way, either as the fancy logo or as plain but well-emphasized text. This same technique works in side the <a> ("anchor") tag, which is covered next, to make an image part of a hyperlink. ( categories: Web Design | Tutorial )
|