|
You can embed images, sounds, and even video clips in your HTML document
by using the IMG and BGSOUND elements. And you can apply simple animation
to text by using the MARQUEE element.
You use the
IMG element to insert images into your document. You specify the image
source, typically a .bmp, .gif, or JPEG file, and specify the image attributes,
such as the width and height, alignment, and so on. The following example
demonstrates how to display a .bmp file, TheEarth.bmp.
<IMG SRC="TheEarth.bmp"
WIDTH=46 HEIGHT=46 ALT="Picture of the Earth">
The SRC= attribute
specifies the name of the image file. The file will be sized in a square
46 pixels wide by 46 pixels high. For a text-only browser, the text "Picture
of the Earth" will display in place of the image.
When you place
an IMG element in text, Internet Explorer aligns the surrounding text with
the bottom of the image. You can align the text with the top or center
of the image by using the ALIGN= attribute to set the alignment to TOP,
BOTTOM, or CENTER. In this case, the image keeps its position within the
surrounding text.
You can also
use the ALIGN= attribute to have the text flow around the image. For example,
setting this attribute to LEFT aligns the image with the left margin and
wraps all subsequent text around the right side of the image. Similarly,
setting it to RIGHT wraps all subsequent text around the left side. When
you use the LEFT or RIGHT alignment, typically it is useful to also use
the BR element with the CLEAR= attribute to stop wrapping and force all
remaining text below the image, as in the following example:
<IMG SRC="TheEarth.gif"
ALIGN=LEFT> Here's some text to the right of a picture.
<BR CLEAR=LEFT>Here's
some text beneath the picture.
You can make
an image a hyperlink hot spot "anchoring" the IMG element to a reference
with the A element. By default, Internet Explorer draws a border around
the image to mark it as a hot spot. To remove the border, set the BORDER=
attribute in the IMG element to zero.
You can add
background sounds or music to your document by using the BGSOUND element.
You specify the address of a sound file, such as a .wav, .au, or MIDI file,
and use the LOOP= attribute to set how often the file plays, as in the
following example:
<BGSOUND
SRC="boing.wav" LOOP=5>You will hear a sound played five times
in a row.
You can animate
a line of text by using the MARQUEE element. The element automatically
scrolls the text, to the left or right, whenever a user views your document.
To animate the text, you enclose it in the element and set attributes for
scroll direction, type, and amount, as in the following example:
<MARQUEE
DIRECTION=RIGHT BEHAVIOR=SCROLL SCROLLAMOUNT=10
SCROLLDELAY=200>This
text is displaying in a right scrolling marquee.</MARQUEE>
In this example,
the text "This text is displaying in a right scrolling marquee." scrolls
from the left margin to the right. After it disappears beyond the right
margin, it starts again at the left. The text moves 10 pixels after each
200 millisecond delay.
You can align
marquees to the left or right, like images, and also set the background
color, height, width, and extra spacing around the marquee. |
|