|
To access the contents, click the chapter and section titles.
Platinum Edition Using HTML 4, XML, and Java 1.2
The third image uses the style class sample2. This style defines a relative position for the imagedefined relative to where the image would have appeared. This image would have appeared directly under the first inline image, so the left and top attributes are relative to that position. As a result, the image appears 50 pixels farther to the left and 200 pixels above this position. In addition, the height of the style is less than the height of the image, so it is scaled in this axis. This image is made to appear below the other two by specifying a z-index attribute value of 1. Finally, the block of text is positioned absolutely, to overlay all three images.
Netscapes <LAYER> TagAlthough the <LAYER> and <ILAYER> tags will not become standard HTML, they are supported in Netscape Navigator; therefore, you might want to learn how to position HTML elements by using them. Sometimes these tags work better in Navigator than the CSS positioning attributes. If you are designing documents for an audience predominantly using Netscapes Web browser, you might want to use the <LAYER> tag. Listing 24.2 shows an HTML document designed to achieve roughly the same HTML element layout as achieved by that shown in Listing 24.1 using the <LAYER> and <ILAYER> tags. Figure 24.2 demonstrates that the result is, in fact, very similar. Listing 24.2 LayerPos.htmUsing Netscapes <LAYER> Tag to Position HTML Elements <HTML> <HEAD> <TITLE>LAYER Positioning</TITLE> </HEAD> <BODY BGCOLOR=#FFFFFF> <CENTER> <H1>LAYER Positioning</H1> <HR> <ILAYER Z-INDEX=2> <IMG SRC=Tux.jpg WIDTH=450 HEIGHT=335 BORDER=0> </ILAYER> <LAYER PAGEX=100 PAGEY=100 Z-INDEX=3> <IMG SRC=Tux.jpg WIDTH=150 HEIGHT=150 BORDER=0> </LAYER> <ILAYER LEFT=275 TOP=-300 Z-INDEX=1> <IMG SRC=Tux.jpg WIDTH=200 HEIGHT=335 BORDER=0> </ILAYER> <DIV STYLE=position: absolute; top: 1.75in; left: 1.5in; z-index: 4;color: yellow; font: 36pt Verdana> Works With Text, Too! </DIV> <HR> </CENTER> <ADDRESS> Jim ODonnell, <A HREF=mailto:odonnj@rpi.edu>odonnj@rpi.edu</A> </ADDRESS> </BODY> </HTML>
Some important differences between these two examples are noted, along with other points of interest, as follows:
The <LAYER>/<ILAYER> tags are currently the centerpiece of Netscapes Dynamic HTML implementation, although that is changing as Netscape moves to a more CSS-oriented approach. Chapter 25, Advanced Netscape Dynamic HTML, discusses the use of these tags in much greater depth. See Content Positioning, p. 618.
|
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. |