Iframe tag in Html

How to use iframe tag in Html?

Welcome to this article and this article is all about the use of the iframe tag in Html, and how to use the iframe tag in Html.

So lets starts the discussion.

What is an iframe tag in Html?:

The iframe tag in Html is an alternative tag of the frameset tag. The term iframe stands for inline frame And this tag actually use to define an inline frame in our Html document, it uses to display a local web page as well as a remote webpage.

A local webpage means a webpage available on the current website and a remote webpage means a webpage available on another website.

And this tag also use to embed other document into our html document.

There are many attributes insides the this tag, and we will discuss about these tags one by one.

How do I create an iframe in Html?

Well, the use of the iframe tag in Html is a very easier method. We can use this tag in a similar process as we use the other Html tags.

To use the iframe tag we need not omit the iframe tag we can use the iframe tag inside the body tag.

iframe tag in html
iframe tag in html

This is the basic syntax of the iframe tag .And here we display the output.

Now we will discuss about the iframe tags attributes.

Src attribute:

The source attribute in the html actually specify the the document address in this tag.

And within the src tag double quotes we have to write the image name that we want to display .

Width attribute:

The width of the iframe tag specifies here.

And we have to define the width of the iframe with the px or pixel.

In Html previous versions it is not necessary to write the px with the width attribute but in the html5 we have to write the px with our width iframe attribute.

Height attribute:

The height attribute actually uses to define the height of the iframe tag and we normally define the width with the pixel also.

Name attribute:

This name attribute use to define the name for our iframe tag.

Srcdoc attribute:

This attribute use to specifies the html content of the page to show in the iframe tag.

Sandbox attribute:

The sandbox attribute is one of the most important attributes in Html. And there are lots of important values inside the iframe sandbox attribute.

The sandbox attribute enables to add an extra set of restrictions for the iframe content.

Some of the restrictions are mentions here-

Treat the content as being from a unique origin, block form submission, block script submission, disable APIs, prevent links from targeting other browsing contexts, block automatically triggered features, etc.

The sandbox has many atributes and we will discuss about all these attributes in later articles.

Conclusion:

This article is all about the iframe tag in html , i hope you like this article and if you have any kind of query then please ask me at the [email protected].

And please follow our website for this kind of informational article.

Also read

How to start Html coding?
Difference between section vs div in Html
Guide about how to do Html in notepad
Learn the basic structure of Html
Different versions of Html