HTML Embed Element

HTML Embed element <embed> can be used to define an embedded object in an HTML document, which is supported by the majority of the browsers we have today.

This element doesn't have a closing tag as shown in the examples below.

<embed src="users.html">
<embed src="picture.jpeg">

The embed object path can be a direct path or a reference path as below.

<embed src="https://randomcodez.com/assets/logo/logo.png">
<embed src="/assets/html/users.html">

HTML Embed Attributes

Here is a list of attributes that an object element can have.

  • Attribute src to point embed object path
  • Attribute width and height to define the object container dimensions
  • Attribute style to define its inline styles
  • Attributes id and class which can be defined on any HTML elements
<embed src="/assets/html/users.html" width="100%" height="200px">
<embed src="/assets/html/users.html" style="background-color: aquamarine; border:5px solid gray;">

Examples

<!DOCTYPE html>
<html lang="en">
<head>
</head>
<body>
    <h1>HTML Embed Element</h1>
    <embed src="/assets/html/users.html">
    <embed src="/assets/html/users.html" width="100%" height="200px">
    <embed src="/assets/html/users.html" style="background-color: aquamarine; border:5px solid gray;">

    <embed src="https://randomcodez.com/assets/logo/logo.png">
</body>
</html>

Overall

HTML Embed elements can be used for embedding web objects or HTML documents into a web page.