|
To access the contents, click the chapter and section titles.
HTML 4.0 Sourcebook
Figure 6.43 HTML example document illustrating the IMG inline image element. Figure 6.44 shows this document as displayed by the Netscape Navigator browser. <HTML> <HEAD> <TITLE> Example of IMG Element </TITLE> </HEAD> <BODY> <H1>Examples of IMG Elements</H1> <P> <IMG SRC="icon-help.gif" ALT="[Test image]" ALIGN=TOP> Here is some text related to the test image. The text is aligned with the top of the image. Note that the text does not flow around the image. <P> <IMG SRC="icon-help.gif" ALT="[Test image]" ALIGN=MIDDLE> Here is some text related to the test image. The text is aligned with the middle of the image. Note that the text does not flow around the image. <P> <A HREF="http://www.bozo.edu/test.html"><IMG SRC="icon-help.gif" ALT="[Test image]" ALIGN=BOTTOM> Here is some text</A> related to the test image. The text is aligned with the bottom of the image, and is also part of the <EM> hypertext link</EM>. <P> Here is a <IMG SRC="icon-help.gif" ALT="" ALIGN="left"> left-aligned image. Note how the text flows around this image, unlike the top, middle and bottom aligned images shown above. The element <CODE>&lt;BR CLEAR="left"></CODE> (there is one just coming up, right after the closing bracket....) <BR CLEAR="left"> (....there it was) creates a line break that clears the text to follow the left-flushed image. </BODY> </HTML>
Figure 6.45 Example HTML document illustrating IMG border, image size rescaling, and spacing control. Browser rendering of this document is shown in Figure 6.46. <HTML> <HEAD> <TITLE> More Examples of IMG Elements </TITLE> </HEAD> <BODY> <H2 ALIGN="center"> More Examples of IMG Elements</H2> <P>Here is a left-aligned image <IMG SRC="icon-help.gif" ALT="[Test image]" ALIGN="left"> with text flowing around it. Note how tight the text is to the image. The next example has attributes <B>HSPACE</B>="15" and <B>VSPACE</B>="15": <BR CLEAR="all"> <P>Here is a left-aligned image <IMG SRC="icon-help.gif" ALT="[Test image]" ALIGN="left" HSPACE="15" VSPACE="15"> with text flowing around it. Note how there is extra space around the image, due to the <B>HSPACE</B> and <B>VSPACE</B> attributes added to the IMG element. <BR CLEAR="all"> <P>Here is a right-aligned image <IMG SRC="icon-help.gif" ALT="[Test image]" ALIGN="right" HEIGHT="60" WIDTH="120"> with the image size rescaled using the <B>HEIGHT</B> and <B>WIDTH</B> attributes. Note that you <EM>must not</EM> use these attribute to resize imagemapped images. <BR CLEAR="all"> <P>Here are three images inside anchor elements: Note how the <B>BORDER</B> attribute controls the border drawn around the images</P> <CENTER> <TABLE WIDTH="60%" CELLPADDING=5> <TR> <TD ALIGN="center"> No Specification <TD ALIGN="center"> <TT>BORDER="0"</TT> <TD ALIGN="center"> <TT>BORDER="8"</TT> </TR> <TR> <TD ALIGN="center"><A HREF="icon-help.gif"><IMG SRC="icon-help.gif" ALT="[Test image]"></A> <TD ALIGN="center"><A HREF="icon-help.gif"><IMG SRC="icon-help.gif" ALT="[Test image]" BORDER="0"></A> <TD ALIGN="center"><A HREF="icon-help.gif"><IMG SRC="icon-help.gif" ALT="[Test image]" BORDER="8"></A> </TR> </TABLE> </CENTER></BODY></HTML> <IMG SRC="bozo.gif" ISMAP>
|
Products | Contact Us | About Us | Privacy | Ad Info | Home
Use of this site is subject to certain Terms & Conditions, Copyright © 1996-2000 EarthWeb Inc. All rights reserved. Reproduction whole or in part in any form or medium without express written permission of EarthWeb is prohibited. Read EarthWeb's privacy statement. |