Home  >  Article  >  Web Front-end  >  The difference between frame and iframe tags

The difference between frame and iframe tags

巴扎黑
巴扎黑Original
2018-05-11 17:41:122183browse

1. Frame cannot be used alone without frameSet, iframe can;

2. Frame cannot be placed in body; it can be displayed normally as follows:

<!--<body>--> 
<frameset rows="50%,*"> 
   <frame   name="frame1"   src="test1.htm"/>  
   <frame   name="frame2"   src="test2.htm"/>  
</frameset> 
<!--<body>-->

The following cannot be displayed normally:
##

<body> 
<frameset rows="50%,*"> 
   <frame   name="frame1"   src="test1.htm"/>  
   <frame   name="frame2"   src="test2.htm"/>  
</frameset> 
<body>

3. Nested in frameSet The iframe must be placed in the body; the following can be displayed normally:

<body> 
    <frameset>  
      <iframe   name="frame1"   src="test1.htm"/>  
      <iframe   name="frame2"   src="test2.htm"/>  
    </frameset>  
  </body>

The following cannot be displayed normally:

 <!--<body>--> 
    <frameset>  
      <iframe   name="frame1"   src="test1.htm"/>  
      <iframe   name="frame2"   src="test2.htm"/>  
    </frameset>  
  <!--</body>-->

4. iframes that are not nested in frameSet can be used at will;
The following can be displayed normally:

<body> 
   <iframe   name="frame1"   src="test1.htm"/>  
   <iframe   name="frame2"   src="test2.htm"/>  
</body> 
<!--<body>--> 
   <iframe   name="frame1"   src="test1.htm"/>  
   <iframe   name="frame2"   src="test2.htm"/>  
<!--</body>-->

5. The height of the frame can only be controlled through frameSet; iframe can be controlled by itself, not through frameSet, such as:

<!--<body>--> 
<frameset rows="50%,*"> 
   <frame   name="frame1"   src="test1.htm"/>  
   <frame   name="frame2"   src="test2.htm"/>  
</frameset> 
<!--</body>--> 
<body> 
<frameset> 
   <iframe height="30%"  name="frame1"   src="test1.htm"/>  
   <iframe height="100"  name="frame2"   src="test2.htm"/>  
</frameset> 
</body>

6 . If more than two iframes are used on the same page, it can be displayed normally in IE, but only the first one can be displayed in Firefox; if more than two iframes are used, it can be displayed normally in both IE and Firefox
The above code was tested in IE7 and firefox2.0.
In addition, theft summary from related forums :-)
1 Frame and Iframe can achieve basically the same functions, but Iframe has more flexibility than Frame.
frame is the frame of the entire page, iframe is an embedded web page element, which can also be said to be an embedded frame
The Iframe tag is also called floatingFrame tag, you can use it to embed a HTML document in an HTML display. The biggest difference between it and the Frame tag is that the content contained in 744a36ce5a80811620fd656a5a6732af47339a95073fc7313e65a7a8ddc71270 embedded in the web page is an integral part of the entire page, while the content contained in a6b59115af808fdb3d02f302deb8ef36660eda582d41f4f6ecd9a0810d30fbff is an independent Individuals can be displayed independently. In addition, using Iframe can also display the same content multiple times on the same page without having to repeat the code of this content.
2iframe can be placed in form. frame does not work.

<table> 
<tr> 
<td><iframe id="" src=""></iframe></td><td></td> 
</tr> 
</table>

3frame必须在frameset里 
而frameset不能与body元素共存,也就说有frameset元素的文档只能是一个框架集,不能有别的东东 
4IFrame是放在网业的什么地方都行   
  但是frame只能放到上下左右四个方向 
5iframme   是活动帧   
  而frame是非活动帧   
  iframe使用方法如下   
  7455c763cb1ccd1b9aa8dc60ff09286c065276f04003e4622c4fe6b64f465b88 
iframe用起来更灵活,不需要frame那么多讲究   
而且放的位置也可以自己设 
iframe是内嵌的,比较灵活,不过也有不好的地方,就是位置在不同的浏览器和分辨率下有可能不同,有时会把本来好好的页面搞得变形 
iframe就没有这个限制 
6iframe   可以加在网页中任何一个地方。   
  而frame   通常做框架页 
iframe是一个网页中的子框架,两网页间是父子关系   
  frame是框架,由多个并列的网页构成 
楼上的说得对,iframe是浮动的。就像是浮动面板,而frame是固定的。只能四个方向上的。   
你可以直接在网页里用一下,看看效果就行了。 
7d5ba1642137c3f32f4f4493ae923989c是被嵌入在网页的元素,而04a0d55efbbfd646a993fbc01f262c57用于组成一个页面的多个框架! 
iframe   更利于版面的设计   
  frame     一条直一条竖的不美观 
frame的那一条线也可以去掉的呦!只不过,iframe更方便对其进行数据的交换吧! 
iframe可以放置到你想放的任意位置,控制起来比frame方便 
8iframe是内部帧,可以嵌在一个页面里面,设置内部帧的属性可以使得整体看上去象一个完整的页面,而不是由多个页面组成,frame有frame的好处,比如何多网站,上面放广告条,左边放菜单,右边放内容,这样上边和左边的内容都可不动,只刷新右边页面的内容,选择iframe还是frame完全看自己的需求。 
说白了,用IFrame比用Frame少一个文件(FrameSet),但支持Frame的浏览器比较多。 
The entire website I made for my company uses iframes, which are not supported by Linux browsers. Oops, it’s ugly, but I still like to use iframes
There are also iframes available Put it in the table, and then set ifame to width=100% height=100%
I can just modify the width and height of my table, which is beneficial to typesetting
In fact, Frame is a control
The usage method is the same as Panle.
frame is a page that divides a web page into multiple pages. It needs to have a frameset page frameset
iframe is a floating frame, which is to add another page to your page,
04a0d55efbbfd646a993fbc01f262c57 use To cut the page horizontally or vertically,
d5ba1642137c3f32f4f4493ae923989c is used to insert a small rectangular window into the page
Frame is generally used to set Page layout, divide the entire page into regular blocks, each block contains a new page.
iframe is used to insert a new page anywhere on the page.
Therefore, Frame is used to control the page format. For example, in a book, the chapter table of contents is on the left and the text is on the right. The text is very long and you need to drag it when reading, but you don’t want the table of contents to be dragged too. No more. Therefore, it is best to use Frame to divide the page into 2 regular pages, one left and one right.
And iframe is more flexible and does not require dividing the entire page. You can use it anywhere on the page iframe embeds new page.

The above is the detailed content of The difference between frame and iframe tags. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn