The <embed> Element
As defined in the HTML Living Standard, the <embed> element represents an embedded external application or interactive content (such as a plugin). It is a void element.
Historically used for Flash or Java Applets, today it is most commonly used to embed PDFs or external SVG files directly into the page flow.
<embed type="application/pdf" src="document.pdf" width="600" height="400">
Accessibility & The "Black Box" Problem
The <embed> element is often treated as a "black box" by assistive technologies. Because the content is external, the browser has limited control over how that content is exposed to the Accessibility Tree.
WCAG Requirement: Perceivability
Success Criterion 1.1.1 (Level A): Non-text content must have a text alternative.
Unlike the <img> tag, the <embed> tag does not have an alt attribute. To make an embed accessible, you must provide a descriptive caption or text alternative immediately preceding or following the element so that screen reader users understand what the embedded content is.
Modern Alternatives
Due to security risks and accessibility limitations, the <embed> tag is largely deprecated in favor of more robust elements:
- For PDFs: Use an
<iframe>or provide a direct link to the PDF file. - For Media: Use
<video>or<audio>. - For Interactive Content: Use custom JavaScript components or SVGs.