embed (HTML element)

    Adam Roberts
    Share

    Description

    embed is a non-standard but well-supported element that’s used to embed multimedia content, including media types that mightn’t usually be natively supported by the browser. It can also be used for embedding media types that are supported, such as images in .jpg, .gif, or .png format.

    embed isn’t part of any currently recognized standard, so if you use it, your page can’t possibly validate; to create valid markup, you’ll need to use the object element, which was defined in HTML 4. That said, using embed is widely recognised as a good way to embed Flash in an accessible manner, and many believe that it’s acceptable to compromise validity for the sake of accessibility.

    embed won’t work for formats that are natively supported in the browser, such as HTML and images — use the built-in, properly supported mechanisms for such formats. The formats that embed supports are generally restricted to those that would require an additional plugin in order to work.

    Although embed is an empty element, an end tag is still required for the sake of browser compatibility.

    Example

    In this example, a super-simple embed element is used to display a video file in .mp4 format:

    <embed src="volksworld-video-report.mp4">
    </embed>

    Use This for…

    This element is used for media files (primarily movie files, such as Flash and QuickTime video).

    In this Section