An <iframe> ("inline frame") embeds another web page inside yours — a YouTube video, a map, a payment widget. It's powerful but needs care around security.
Using an iframe
<iframesrc="https://www.youtube.com/embed/VIDEO_ID"title="Descriptive title"width="560" height="315"loading="lazy"allowfullscreensandbox="allow-scripts allow-same-origin"></iframe>
Key takeaways
- 01An <iframe> embeds another web page (video, map, widget) inside yours.
- 02Only embed trusted sources — an iframe runs external content.
- 03Use the sandbox attribute to restrict what embedded content can do.
- 04Always add a title for accessibility and loading="lazy" for performance.
