| Including Alternative Text |
Alternative text describes an image that
you have inserted. Alternative text is included for the following reasons:
|
|
Some of your visitors may
be using text only browsers. |
|
|
A visitor may have turned
off images so that a file will load faster. |
|
|
Sometimes browsers don't display images correctly. |
|
|
Sometimes images don't
display because the links aren't working properly. |
You should always use two attributes with
any <IMG> tag: the SRC
and ALT attributes, both of which are required. The ALT attribute
is used to describe the image in some way. For any browser
that isn't displaying images, the alternate text contained
inside that ALT attribute is displayed instead. Here's an
example of an image element using alternate text:
<IMG SRC="images/mickeymouse.jpg"
ALT="Mickey Mouse">
If you use this tag, browsers can display
the words "Mickey Mouse" instead of displaying an image.
| Specifying Height and Width |
You can speed the loading time of images
by specifying an image's height and width. As the browser
loads the page, it notes the height and width attributes and
leaves that much space for the image. Next, it lays out the
remaining text, and then it goes back and fills in the image.
To specify image height and width, add the HEIGHT= and WIDTH=
attributes in the <IMG> tag.
One overwhelming advantage to adding the
height and width to an <IMG>
tag is that when you do specify the image size for all of
your images, browsers take a lot less time to render your
page. That's because the browser can determine the layout
of the page without having to retrieve each image separately
to find out what size it is.
However, there are two drawbacks to specifying the height and width:
|
|
The height and width are
presentational attributes, so they ideally belong in a
style sheet instead of in your <IMG> tag. |
|
|
If you have a very small
image and specify its height and width, then Navigator
and IE won't be able to fit the alternate text inside
the small image box for those users not displaying images. |
By default, images align on the left, with
accompanying text appearing on the same line. The alignment
options within the <IMG>
tag override other alignment settings. Setting an image to
ALIGN="RIGHT" and then, the accompanying text to
ALIGN="RIGHT" forces the text to be flush against
the image with a ragged left margin. Certain alignment options
such as TOP, MIDDLE, and BOTTOM offer more in the context of small images.
When you align images with an alignment
attribute, there are two entirely separate behaviors - Inline Images and Floating Images.
To align an image in a line, choose one
of the following attributes for the image element:
ALIGN="TOP"
ALIGN="MIDDLE" ALIGN="BOTTOM"
To make an image "float" to the
left or right side and paragraphs to wrap around the image,
choose one of the following attributes:
ALIGN="LEFT" ALIGN="RIGHT"
You can control the border around an image
with the BORDER=attribute. In most browsers, by default, the
border is visible only on images that are used as links. To
turn the border off for all images, add the BORDER="0"
attribute to the <IMG>
tag. You can increase the border width around an image by
increasing the value in the BORDER=attribute.
|
|
If you use the BORDER="1"
attribute in an <IMG> tag, then a thin border will appear around the image. |
|
|
An image border will always
be colored black in IE4, while in Navigator it's the same color as the text color. |
|
|
If you use a style sheet,
you can specify whatever color you desire for image borders. |
|
|
An image's border width
does not count toward determining an image's height or width. |
Example:
<A HREF="http"//www.bamm.org/."><IMG
SRC="sbamm.jpg" BORDER="10"></A>
Copyrights : Layout Galaxy All Rights Reserved
No part of this tutorial may be reproduced, stored in a retrieval system or transmitted in any form or by any means, electronic, electrostatic, magnetic tape, mechanical or otherwise, without prior permission in writing from Layout Galaxy.
|
|