pub struct Embed;Expand description
The <embed> element - embeds external content at the specified point.
§Purpose
The <embed> element represents an integration point for external application or
interactive content, typically handled by a browser plugin. While historically used
for Flash and other plugins, it’s now primarily used for embedding PDFs and other
plugin-based content. Modern alternatives like <video>, <audio>, and <iframe>
are preferred when applicable.
§Content Categories
- Flow Content
- Phrasing Content
- Embedded Content
- Interactive Content
- Palpable Content
§Permitted Content Model
- None (void element)
§Common Use Cases
- Embedding PDF documents inline
- Displaying plugin-based content (legacy)
- Embedding specialized media types
- Integration with native applications
- Displaying Flash content (legacy, deprecated)
§Key Attributes
src: URL of the resource to embed (required)type: MIME type of the embedded contentwidth: Width in CSS pixelsheight: Height in CSS pixels- Any custom attributes for the plugin
§Example
<!-- Embedding a PDF document -->
<embed src="/documents/manual.pdf"
type="application/pdf"
width="800"
height="600">
<!-- Embedding with explicit dimensions -->
<embed src="/media/content.swf"
type="application/x-shockwave-flash"
width="640"
height="480">
<!-- Simple embed without type -->
<embed src="/files/document.pdf" width="100%" height="500">
<!-- Embed with custom parameters -->
<embed src="/plugin/app.plugin"
type="application/x-custom-plugin"
width="400"
height="300"
quality="high">§Accessibility
- Provide alternative content mechanisms when possible
- Ensure embedded content is keyboard accessible
- Consider using modern alternatives (
<iframe>,<video>,<audio>) - Test with assistive technologies
- Provide download links as fallback
§WHATWG Specification
Trait Implementations§
Source§impl HtmlElement for Embed
impl HtmlElement for Embed
impl EmbeddedContent for Embed
impl FlowContent for Embed
impl InteractiveContent for Embed
impl PalpableContent for Embed
impl PhrasingContent for Embed
Auto Trait Implementations§
impl Freeze for Embed
impl RefUnwindSafe for Embed
impl Send for Embed
impl Sync for Embed
impl Unpin for Embed
impl UnwindSafe for Embed
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more