What is an iframe in HTML and what is it used for?

An iframe (inline frame) shows another web page inside your page. It is used to embed YouTube videos, Google Maps, payment forms and widgets.

<iframe src="https://www.example.com" width="600" height="400" title="Example"></iframe>
  • Always give a title, width and height.
  • Some sites block embedding, and then the frame stays blank.
  • Use sandbox and loading="lazy" for safety and speed.

See HTML Iframes.


Learn more about the similar topics:
Tutorials
HTML Frames
HTML Iframes
HTML5 Introduction
HTML Multimedia
HTML5 Video
HTML5 Audio
HTML5 Canvas
Exercises & Assignments
No Content Found.
Interview Questions & Answers
What are the new multimedia elements in HTML5?
How do you insert a video in HTML?
What is the difference between HTML and HTML5?
What is an iframe in HTML and what is it used for?
What is the difference between canvas and SVG in HTML5?
What is the difference between localStorage, sessionStorage and cookies?