Basically the difference between <frame>
tag and <iframe>
tag is :
When we use <frame>
tag then the content of a web page constitutes of frames which is created by using <frame>
and <frameset>
tags only (and <body>
tag is not used) as :
<html>
<head>
<title>HTML Frames</title>
</head>
<frameset rows="20%,70%,10%">
<frame name="top" src="/html/top.html" />
<frame name="main" src="/html/main.html" />
<frame name="bottom" src="/html/bottom.html" />
</frameset>
</html>
And when we use <iframe>
then the content of web page don't contain frames and content of web page is created by using <body>
tag (and <frame>
and <frameset>
tags are not used) as:
<html>
<head>
<title>HTML Iframes</title>
</head>
<body>
<p>See the video</p>
<iframe width="854" height="480" src="https://www.youtube.com/embed/2eabXBvw4oI"
frameborder="0" allowfullscreen>
</iframe>
</body>
</html>
So <iframe>
just brings some other source's document to a web page. The <iframe>
are used to specify inline frames or floating frames. The World Wide Web Consortium (W3C) included the <iframe>
feature in HTML 4.01.
<frameset>
tags were used to create frames with the tag <frame>
whereas <iframe>
fulfills functions of both <frame>
and <frameset>
tags. Unlike <frame>
tags, <iframe>
tags can also be placed inside the <body>
tags.
Placement of <iframe>
is easy, a coder can easily put the <iframe>
tag among the other webpage tags, and also add several <iframe>
tags if he/she wants. On the other hand, placing <frame>
tags in <frameset>
is bit complicated.
Note : <frame>
tag and <frameset>
tag are deprecated in HTML5
So now as use of <frame>
and <frameset>
tag is deprecated so web developers use <body>
tag for creating content of a webpage and for embedding some other source's document in the web page <iframe>
tags are used. But even <frame>
tags were also used to embed other source's document in a webpage and even <iframe>
tags are also used to create frames.