w1coding.comAll tutorials

HTML Iframes

HTML lessons
  1. Environment Setup
  2. Introduction
  3. Basics
  4. Editors
  5. Elements
  6. Attributes
  7. Heading
  8. Paragraphs
  9. Styles
  10. Formatting
  11. Quotations
  12. Comment
  13. Colors
  14. CSS
  15. Links
  16. Images
  17. Favicon
  18. Title
  19. Tables
  20. Block And Inline
  21. Lists
  22. Div
  23. Classes
  24. ID
  25. Iframes
  26. Responsive

What is an iframe?

The <iframe> element is used to embed another document within the current HTML document. It creates a nested browsing context, allowing you to display content from another source, such as another webpage or multimedia content.

How to Use iframe

You can define an iframe in your HTML using the <iframe> tag. Here’s a basic example:

<iframe src="https://www.example.com"></iframe>

The src attribute specifies the URL of the page to embed.

Examples of iframe

Example 1: Basic iframe

Here is a simple iframe that loads a webpage:

Example 2: iframe with Additional Attributes

This iframe includes width, height, and border attributes:

Example 3: Responsive iframe

This iframe is styled to be responsive: