HTML Iframes
Learn how to embed other HTML pages within a page using iframes
Introduction to HTML Iframes
The <iframe> tag is used to embed another HTML page within the current page.
An <iframe>(short for inline frame) allows you to embed another webpage or document inside your HTML page — such as YouTube videos, Google Maps, PDFs, or even entire websites.
Basic Iframe Example:
<iframe src="https://www.codingrider.com" width="600" height="400" title="Example Iframe"></iframe>
This code creates an iframe that embeds the CodingRider homepage.
Example outtput:
In this example, the iframe is set to a width of 600 pixels and a height of 400 pixels. The title attribute provides a descriptive
| Attribute | Description |
|---|---|
src |
URL of the page to embed |
width |
Width of the iframe in pixels or percentage |
height |
Height of the iframe in pixels or percentage |
title |
Descriptive title for accessibility |
frameborder |
Specifies whether to display a border around the iframe (0 or 1) |
allowfullscreen |
Allows the iframe to be displayed in fullscreen mode |
loading |
Controls when the iframe content is loaded (e.g., "lazy" for lazy loading) |