Embedding Videos and OtherDynamic Content with iFrames

Shevanie Shupreeya P
featurepreneur
Published in
Feb 10, 2023

<iframe> tag creates an inline frame for embedding third-party content like media.

iframe stands for an inline frame.

This is used to load another HTML element inside of the web page.

Syntax:

 <iframe src="link"></iframe>

It is by default 300x150 pixels in size.

Adding a youtube video to our HTML:

Youtube videos can be added easily to our HTML using the <iframe> tag.

First, we should choose the youtube video that we need to add.

Then click the share icon there you can find the embed option.

Copy the iframe content and paste it into the body of the HTML.

<iframe width="560" height="315" src="https://www.youtube.com/embed/dvNpQXh2aAk" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>

We can also add CSS property to the iframe.

--

--