HTML HTML Tutorial HTML Forms HTML Graphics HTML Media HTML APIs HTML Tags



HTML Tag: embed

The HTML Tag: embed is used to embed external content such as images, videos, audio files, and other multimedia content into a web page. This tag is used to display content that is not directly supported by the browser, such as Flash animations or Java applets.

The embed tag is a self-closing tag, which means that it does not require a closing tag. It is also an inline element, which means that it can be placed within a paragraph or other text element.

The embed tag is used to embed external content into a web page. It is commonly used to display multimedia content such as videos, audio files, and images. The tag is used to display content that is not directly supported by the browser, such as Flash animations or Java applets.

The embed tag has several attributes that can be used to customize the appearance and behavior of the embedded content. These attributes include the source attribute, which specifies the URL of the content to be embedded, and the type attribute, which specifies the MIME type of the content.

Other attributes that can be used with the embed tag include width and height, which specify the dimensions of the embedded content, and autoplay, which specifies whether the content should start playing automatically when the page loads.

Example 1: Embedding an Image

To embed an image using the embed tag, you can use the following code:

<embed src="image.jpg" type="image/jpeg" width="500" height="500" />

This code will embed an image called "image.jpg" into the web page. The width and height attributes specify the dimensions of the image, and the type attribute specifies the MIME type of the image file.

Example 2: Embedding a Video

To embed a video using the embed tag, you can use the following code:

<embed src="video.mp4" type="video/mp4" width="640" height="360" autoplay="true" />

This code will embed a video called "video.mp4" into the web page. The width and height attributes specify the dimensions of the video player, and the autoplay attribute specifies that the video should start playing automatically when the page loads.

Example 3: Embedding an Audio File

To embed an audio file using the embed tag, you can use the following code:

<embed src="audio.mp3" type="audio/mpeg" width="300" height="40" />

This code will embed an audio file called "audio.mp3" into the web page. The width and height attributes specify the dimensions of the audio player, and the type attribute specifies the MIME type of the audio file.

Activity