MakeW3web

HTML Iframes

HTML iframes allow you to embed another HTML document within your current web page. They are commonly used to display content from other sources, such as maps, videos, or external websites. The `<iframe>` element is used to create an inline frame in your HTML document.

Here's the basic syntax for creating an iframe:

<iframe src="URL" width="WIDTH" height="HEIGHT"></iframe>
  • `src`: Specifies the URL of the document you want to embed.
  • `width` and `height`: Set the dimensions of the iframe. You can use pixels or percentages as units.
Example:
<!DOCTYPE html>
<html>
  <head>
    <title>HTML Iframe Example</title>
  </head>
  <body>
    <h1>Iframe Example</h1>
    <p>This is an example of an iframe embedding another webpage:</p>
    <iframe src="https://example.com" width="800" height="600"></iframe>
  </body>
</html>

In this example, the iframe embeds the webpage "https://example.com" with a width of 800 pixels and a height of 600 pixels.

Was this page helpful?