HTML embed Tag
<embed> tag can be used to include images, videos, another webpage, etc, into our webpage. The
<embed> tag creates a container, for which we can specify the width and height, and in that container, we can show anything we want, it can be an image, a video, another webpage by providing the URL for the resource.
<embed> tag is supported by internet explorer, Netscape Navigator, Windows as well as on Mac platforms.
It uses three mandatory attributes and these are:
<embed> Tag - Syntax and Usage
<embed> element is an open tag, which means it doesn't require a closing tag.
<embed src="URL_OF_RESOURCE" height="..." width="..." />
src attribute will provide the URL of the resource that we want to embed/include in our webpage.
<embed> Tag Basic Example
Let's take a simple example where we will use the embed tag to include a picture and a webpage:
In the example above, we have used the
<embed> tag to include an image by providing its URL and specifying the
width attribute. In the
width attribute we provided the value auto, that is to automatically adjust the width as per the given height to maintain the aspect ratio. We can specify a value for
width attribute and provide the value as auto for
<embed> Tag Attributes
||specifies the URL of the resource to be embedded. This attribute is mandatory.|
||specifies the width of the embedded content|
||specifies the height of the embedded content|
||specifies the type of the embedded content|
Don't use <embed> Tag unnecessarily
We can use the <img> tag to include an image in a webpage, and use the <video> tag for adding a video in our webpage and to include any other webpage as snippet we can use the <iframe> tag. The
<embed> tag can be used for some specific usecase.
Browser Support for HTML
Following browsers support this attribute:
Google Chrome 2+
Internet Explorer 5.5+