<embed> tag in HTML is utilized to embed content like images, videos, or other HTML pages within a web page. It’s a versatile tag that allows you to include various media types directly into your content. However, it’s essential to note that support for Java Applets, ActiveX controls, and Shockwave Flash has been discontinued in modern browsers.
- To display a picture, it is better to use the
- To display HTML, it is better to use the
- To display video or audio, it is better to use the
These suggestions provide more modern and widely supported alternatives to the
<embed> tag for specific content types. Following these recommendations ensures that your embedded content is accessible to a broader audience across various browsers and devices.
Example 1: Embedding an Image
You can use the
<embed> tag to embed an image within your web page:
<embed src="image.jpg" type="image/jpg" width="300" height="200">
Example 2: Embedding an HTML Page
To embed another HTML page within your current page, you can use the following code:
<embed src="page.html" type="text/html" width="800" height="600">
Example 3: Embedding a Video
You can also embed a video file using the
<embed src="video.mp4" type="video/mp4" width="640" height="360">
Warning: Most browsers no longer support Java Applets, Plug-ins, ActiveX controls, and Shockwave Flash. It’s better to use the
<img>tag for images, the
<iframe>tag for HTML, and the
<audio>tags for videos and audio files.
|height||pixels||Specifies the height of the embedded content|
|src||URL||Specifies the address of the external file to embed|
|type||media_type||Specifies the media type of the embedded content|
|width||pixels||Specifies the width of the embedded content|
<embed> tag supports all the global attributes in HTML.
<embed> tag also supports all the event attributes in HTML.