Ad space (banner)
🎨HTML & CSS Lessons
Lesson 21 / 50

iframe (Embedding Another Page)

In this lesson you'll learn how to embed another page with the iframe tag, so you can understand how embedding maps or video works. This is for people searching "HTML iframe usage."

Using an <iframe> tag lets you embed a separate web page inside your own page, like a "window." This is commonly used on real websites for things like embedding a map or a video. width and height specify the display size, and title specifies a description of the content.

The sample code embeds a separate page into a frame with a width of 100% and a height of 150px, in the form <iframe src="URL" width="100%" height="150">. The title attribute isn't shown on screen, but it plays the role of telling people using screen-reader software "what's embedded here."

A common beginner stumbling block is that, depending on the settings of the site you're embedding, being shown in an iframe at all can be refused. For security reasons, many sites block being embedded in an iframe, so not every page can be freely embedded.

If you've ever used a YouTube embed code or Google Maps's share feature, this iframe tag is actually what's working behind the scenes. It's a standard, widely used method whenever you want to pull an external service's content into your own site.

HTML & CSS
OUTPUT

💡 The preview runs entirely on this page — nothing is sent externally.

Ad space (banner)
Ad space (in-article)