HTML <applet> tag

Updated: 10/11/2017 by Computer Hope

HTML applet tagWhen writing in HTML, the <applet> tag is a block element used to embed a Java applet. It is useful when you want to add more functionality to your web pages. The following sections contain information about this tag, including an example of its code, as well as related attributes and browser compatibility.

Note: The <applet> tag has been deprecated. Going forward, you should use the <embed> or <object> tags.

Example code

<applet code="BounceLetters.class" width="350" height="350">
Java applet that draws bouncing text characters.
</applet>

Required attributes

Within an HTML tag, an attribute dictates certain aspects of an HTML element. Attributes are made up of a name and value pair; all tags support standard attributes. The following table shows attributes that have to be used with the <applet> tag, as well as a description of each.

Attribute Description
code Designates the Java applet's file name
object Designates the URL of a serialized representation of an applet

Optional attributes

An optional attribute is one that may be used in addition to those listed above, but is not required for the <applet> tag to work properly.

Attribute Description
align Designates the alignment of an applet with respect to it's surrounding elements
alt Designates alternate text for an applet
archive Designates an archive file's location
codebase Designates a URL for applets specified in the code attribute
height Designates the height of the applet
hspace Sets the horizontal spacing around the applet
name Sets a name for the applet
vspace Sets the vertical spacing around the applet
width Designates the width of the applet

Compatibility

Internet Explorer Firefox Safari Opera Chrome
All versions * All versions * All version * Not supported Not supported

*Until it is removed in a future version of HTML

Browser, Compatibility, Code, CSS, Java, JavaScript, URL, Web design terms