HTML

HTML Iframes

An <iframe> is used to embed another webpage or external content inside the current webpage.

Common uses include:

  • YouTube videos
  • Google Maps
  • Other webpages
  • Online documents

Basic Syntax

<iframe
    src="https://skillmantraedu.com/"
    width="600"
    height="400"
>
</iframe>

Important Attributes

  • AttributeDescription
    srcSpecifies the embedded content
    widthSpecifies width
    heightSpecifies height
    titleDescribes the iframe
    allowfullscreenAllows fullscreen mode
    loadingControls loading behavior
<iframe
    src="https://skillmantraedu.com"
    width="600"
    height="400"
    title="Example Website" 
    > 
</iframe>

Embedding a YouTube Video

<iframe width="560" height="315" 
src="https://www.youtube.com/embed/5kc4UjomBx8?si=004tW5KAcwrntk0s" title="YouTube video player" 
frameborder="0" 
allow="accelerometer; 
autoplay; 
clipboard-write; 
encrypted-media; gyroscope; picture-in-picture; web-share" 
referrerpolicy="strict-origin-when-cross-origin" 
allowfullscreen
>
</iframe>
Interactive Sandbox
HTML/CSS/JS