HTML <applet> tag

Updated: 11/13/2018 by Computer Hope
HTML applet tag

When 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 is 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

In an HTML tag, attributes dictate certain aspects of an HTML element. Attributes are made up of a name and value pair. All HTML 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 its 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

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

*Until it is removed in a future version of HTML

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