
|
|
The <img> is possibly one of the most important tags in HTML, it allows you
to use colorful graphics on your web pages, as well as styled text.
It can take a wide variety of attributes:
SRC - a URL pointing to the graphic to be displayed.
ALT - a text only equivalent for the graphic, used by non-graphic
browsers or when images are turned off. Leave it blank if you don't want it to
show up in a text only Web Browser.
ALIGN - describes how the image should be aligned relative to the
text.
width, height - the width and height in pixels of
the image. Use these whenever possible to speed up the formatting of your page -
a decent browser will skip the image and carry on displaying text if it hasn't
completely loaded it yet. You can find out the size of an image with most graphic
editing software, or by opening the image in Netscape.
border - specifies the thickness of the border around an linked
image. A linked images is an image used instead of text as a link to another
document.
Code examples:
<img src="food.gif" alt="Table with food on it" width=160
height=210>
What does this do? Well it displays food.gif, with a width of 160 and a height of 210
pixels. If images are turned off, displays "Table with food on it" as the alternate text only label.
Alignment in more detail:
The attribute align can take the following values:
top - aligns graphic with the top of the tallest item in the line.
middle - aligns baseline of the current line with the middle of the graphic
bottom - aligns the bottom of the image with the baseline of the current line.
left - puts graphic at the left-hand side of the page.
right - displays graphic at the right-hand side of the page.
Note that graphics aligned with the left or right border, while looking very
nice, can look spectacularly ugly on a browser than doesn't support such
alignment of images. But, such browsers are vanishing quite rapidly.
 
|
|
|