You are currently viewing a snapshot of www.mozilla.org taken on April 21, 2008. Most of this content is highly out of date (some pages haven't been updated since the project began in 1998) and exists for historical purposes only. If there are any pages on this archive site that you think should be added back to www.mozilla.org, please file a bug.



You are here: Test Case Description for applets within <applet> tag > Test Case #7 for applets within <applet>: relative height

Applets: APPLET (relative height)

This test case tests the <applet> tag with its height attribute which, similar to the <img> tag, explicitly specifies the height of the java applet. The height attribute can either be an absolute height using an integer value of pixels or a relative height using a relative percentage value.

If the height attribute of an <applet> is using a relative height and if the height of its containing block is not specified explicitly (i.e., it depends on content height), then the height of the <applet> will compute to "auto". When this case happens, then the height refers to the intrinsic height for <applet> which is 240px. Therefore, if the height attribute of an <applet> is using a relative height, then the height of its containing block should be specified explicitly.

Test Case #1: sample java applet dimension scaling using relative heights
(using <applet codebase=class pathname code="class name" height=percent value> </applet>)

Java Applet Dimensions Scaled Down (Reverse Scaling)

Original applet (with an height of 80px)

Applet height="75%" within a <p> with a specified height of 400px

Applet height="50%" within a <p> with a specified height of 400px

Applet height="25%" within a <p> with a specified height of 400px

Applet height="80%" within a <p> that has no specified height, with an auto-height

The above <applet> should be 240px in height precisely.