<applet>
<applet>
Element
The <applet>
element was used to embed Java applets in web pages, enabling interactive functionality. It included attributes such as <code>
, <width>
, and <height>
to define the applet's behavior and appearance. However, the <applet>
tag is deprecated in HTML5, and modern alternatives like <object>
are recommended instead.
Syntax
<applet code="URL" height="200" width="100">
...
</applet>
<applet>
Demo
To embed a video in your webpage, use the <video>
element:
<video width="320" height="240" controls>
<source src="movie.mp4" type="video/mp4">
</video>
To embed audio in your webpage, use the <audio>
element:
<audio controls>
<source src="horse.ogg" type="audio/ogg">
</audio>
Example
- Embed a document using the
<embed>
element:
<embed src="snippet.html">
- Embed an image using the
<embed>
element:
<embed src="img.jpg">
- Embed a document using the
<object>
element:
<object data="snippet.html"></object>
- Embed an image using the
<object>
element:
<object data="img.jpg"></object>
Key Points
- Purpose: Used to embed Java applets in web pages for interactivity.
- Attributes:
- Obsolescence: The
<applet>
element is deprecated in HTML5; use<object>
or<embed>
instead.
Conclusion
The <applet>
element was used to embed Java applets for interactivity in web pages, with attributes like <code>
, width
, and height
defining its behavior and appearance. However, it has been deprecated in HTML5 due to security concerns and is no longer recommended. Modern alternatives like <object>
and <embed>
should be used to embed multimedia or external content. These alternatives provide better compatibility and security for web development.
<link>
The HTML <link> element defines the connection between the current document and external resources, often used to link stylesheets, icons, and other files within the <head> section.
<base>
The HTML <base> element sets a base URL for resolving all relative links and resources within a document, providing a reference point for those URLs.