HTML5ANDCSS3 logoHTML5ANDCSS3Tools and Tutorials
  • Insights
  • Verify Certificate
HTML5ANDCSS3 logoHTML5ANDCSS3Tools and Tutorials
HTML5ANDCSS3 logoHTML5ANDCSS3Tools and Tutorials

HTML5andCSS3.org helps developers learn modern frontend skills with practical tutorials, production-ready snippets, and fast web tools built for everyday coding.

Quick Links

  • About Us
  • Contact Us
  • Privacy Policy
  • Copyright
  • Disclaimer

Top Tools

  • Try It Editor
  • JSON Formatter
  • CSS Minifier
  • HTML Minifier
  • Base64 Encoder / Decoder

Contact

  • business@html5andcss3.org
Newsletter

Learn at your own pace, practice with useful tools, and build websites you're proud of.

© 2011-2026 html5andcss3.org. All rights reserved.

How to Use

HTML Tutorial

HTML Basics

Introduction to HTMLHTML EditorsHTML StructureHTML Elements & AttributesHTML HeadingsHTML ParagraphsHTML FormattingHTML CommentsHTML Styles

HTML Text and Links

HTML Text FormattingHTML Quotations & CitationsHTML LinksHTML Email Links

HTML Lists and Tables

HTML ListsHTML TablesTable Styling & Borders

HTML Images and Media

HTML ImagesHTML Picture ElementHTML AudioHTML VideoHTML Embed & Object

HTML Forms

HTML Forms OverviewHTML Form ElementsHTML Input TypesHTML Input AttributesHTML Form AttributesHTML Form Validation

HTML Layout

HTML Block vs Inline ElementsHTML Div & SpanHTML Semantic Layout TagsHTML Iframes

Advanced HTML

HTML Entities & SymbolsHTML EmojisHTML Head Element TagsHTML Meta Tags for SEOHTML Responsive Design

HTML References

HTML5 New TagsDeprecated TagsHTML Global AttributesEvent AttributesComplete HTML Tag ListComplete HTML5 ElementsHTML Tutorial PDF
  1. Home
  2. /
  3. Tutorials
  4. /
  5. HTML Tutorial
  6. /
  7. HTML Embed & Object

HTML Images and Media

HTML Embed & Object

HTML provides the <embed> and <object> elements to include external content in web pages, such as PDFs, multimedia files, or interactive applications. These elements allow you to integrate non-HTML content seamlessly, giving your website rich functionality beyond standard images, audio, or video.

HTML <embed> Element

The <embed> element is used to embed external content directly, such as PDFs, videos, or Flash (legacy). It is a self-closing tag.

Syntax

html

<embed src="example.pdf" type="application/pdf" width="600" height="400">

Explanation:

  • src: Path or URL of the external file.
  • type: MIME type of the file (e.g., application/pdf, video/mp4).
  • width & height: Size of the embedded content.

HTML Embed Example

html

<embed src="https://ik.imagekit.io/html5andcss3/lesson-samples/sample.pdf" type="application/pdf" width="600" height="800">

This displays a PDF file directly inside the web page.

HTML <embed> Attributes

AttributeDescription
srcURL or path of the external file to embed.
typeMIME type of the embedded content (e.g., application/pdf, video/mp4).
widthWidth of the embedded content (in pixels or %).
heightHeight of the embedded content (in pixels or %).
autoplayAutomatically starts playing audio or video (if supported).
loopLoops the media (video/audio).
hiddenHides the embedded content from display.
styleCSS styling (can be used to hide sidebars, borders, or adjust appearance).

HTML <object> Element

The <object> element is a more versatile container for external resources, such as PDFs, multimedia, or HTML pages.

HTML Object Syntax

html

<object data="example.pdf" type="application/pdf" width="600" height="400">
  Your browser does not support embedded objects.
</object>

Explanation:

  • data: Path or URL of the external file.
  • type: MIME type of the file.
  • width & height: Dimensions of the embedded content.
  • Inner content: Fallback text or HTML displayed if the browser cannot load the object.

HTML Object Example

html

<object data="https://ik.imagekit.io/html5andcss3/lesson-samples/sample.pdf" type="application/pdf" width="600" height="800">
  <p>It appears your browser does not support PDF viewing. <a href="https://ik.imagekit.io/html5andcss3/lesson-samples/sample.pdf">Download the PDF</a>.</p>
</object>

HTML <object> Attributes

AttributeDescription
dataURL or path of the external file.
typeMIME type of the content.
widthWidth of the embedded object.
heightHeight of the embedded object.
formAssociates the object with a form.
nameAssigns a name to the object for scripting purposes.

Differences Between <embed> and <object>

Feature<embed><object>
Fallback contentNoneSupported
HTML compatibilityHTML5HTML4 & HTML5
FlexibilityLess flexibleMore flexible
Multimedia supportYesYes
Use for PDFsYesYes

⚠️ Tip: Use <object> if you want fallback content or additional HTML inside the element. Use <embed> for simple embedding.

Removing PDF toolbar/sidebar using parameters in URL

PDF Toolbar Removing Example with <embed>

html

<embed src="https://ik.imagekit.io/html5andcss3/lesson-samples/sample.pdf#toolbar=0&navpanes=0&scrollbar=0" type="application/pdf" width="600" height="500">

PDF Toolbar Removing with <object>

PDF Toolbar Removing Example with <object>

html

<object data="https://ik.imagekit.io/html5andcss3/lesson-samples/sample.pdf#toolbar=0&navpanes=0&scrollbar=0" type="application/pdf" width="600" height="500">
  <p>Your browser cannot display this PDF. <a href="https://ik.imagekit.io/html5andcss3/lesson-samples/sample.pdf">Download PDF</a></p>
</object>

Explanation:

  • You can control the display of PDF toolbars, navigation panels, and scrollbars by appending parameters in the URL (#toolbar=0&navpanes=0&scrollbar=0).
  • The <object> fallback allows users to download the file if it cannot be displayed.

⚠️ Note: Some PDF viewers ignore certain parameters depending on the browser or plugin.

Advantages

  • Embed multimedia, PDFs, or interactive content directly.
  • <object> allows fallback HTML content.
  • Both elements work across modern browsers for supported formats.
  • Improves user experience without redirecting to external files.

Tips for Embedded Media

  1. Always specify width and height to reduce layout shifts.
  2. Test PDF URL parameters across browsers because built-in PDF viewers may ignore them.
  3. Use fallback content inside <object> so users can access or download the resource.
  4. Use <audio> and <video> instead of <embed> or <object> for media playback.
  5. Do not add obsolete <param> children to <object>.

Browser Support

Chrome
Edge
Firefox
Safari
Opera
IE9+
YesYesYesYesYesYes

Conclusion

The <embed> and <object> elements can display supported external resources such as PDFs.
<object> is useful when fallback HTML is required. Prefer dedicated HTML elements for audio, video, images, and webpages.

PreviousHTML VideoNextHTML Forms Overview