w3resource logo


embed element - HTML5 tutorials

HTML5 embed Element Tutorial

Secondary Nav

Introduction

HTML5 embed element represents external non-HTML application or interactive content. A good example is when embed element is used to represent a flash movie(SWF file).

embed element

Usage

<embed src="example.swf" />

Whether start and end tag are required

The start tag is required but there is no end tag. So, this is a void element.

Which other elements an embed element can contain

It can not contain any other element.

Parent elements of embed element

The following elements (by category they are phrasing element) an contain embed element :

a or em or strong or small or mark or abbr or dfn or i or b or s or u or code or var or samp or kbd or sup or sub or q or cite or span or bdo or bdi or br or wbr or ins or del or img or embed or object or iframe or map or area or script or noscript or ruby or video or audio or input or textarea or select or button or label or output or datalist or keygen or progress or command or canvas or time or meter

Attributes

embed element may have Global attributes, src, type, height and width attributes. The following table shows detail:

Attributes Description
global attributes Any attributes which are permitted globally.
src Value of this attribute represents the url of the embedded content.
type Represents the MIME type of the content embedded. Value must be a valid MIME media type.
height Represents the height of the embedded content. Value is a non-negative integer. Unit is pixels.
width Represents the width of the embedded content. Value is a non-negative integer. Unit is pixels.

Example

<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset=utf-8>
<title>HTML5 embed element example</title>
</head>
<body>
<article>
<embed src="demo.swf"  height="300px" width="500px" />
</article>
</body>
</html>

Result

embed element result

Browser Compatibility

We have successfully tested the above example with following browser versions.

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support 21.0.1180.79m 14.0.1 8.0 11.50 4.0


Join our Question Answer community to learn and share your programming knowledge.

Help the community:

PHP: Loop

JavaScript: Delete duplicates in an array

Oracle: Round the number