Skip to content
Justice Tech School

Iframes

An iframe shows another web page inside your page. Always give it a title for accessibility. Use the sandbox attribute to restrict what the embedded page may do.

Many sites refuse to be embedded, and embedded pages can slow yours down, so use iframes only when you need them.

Example
<iframe title="Embedded note" width="300" height="100" srcdoc="<p style=&quot;font-family:sans-serif&quot;>I am a page inside a page.</p>"></iframe>

Embedding a real site

Example
<iframe src="https://example.com" title="Example site" width="400" height="300"></iframe>

Exercise

Add the accessible name of the iframe.

<iframe src="/map" ="Our location"></iframe>

Quiz Test

Which attribute restricts what an embedded page can do?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.