当前位置: 首页 > 网络学院 > 网页制作基础教程 > HTML > HTML <frame>标签
Defines a sub window (a frame).
定义一个子窗口(一个框架)
In HTML the <frame> tag has no end tag.
在HTML中<frame>标签不需要结束标签
In XHTML the <frame> tag must be properly closed.
在XHTML 中<frame>标签必须合理关闭
Note: If you want to validate a page containing frames, be sure the DTD is set to "Frameset DTD". Read more about XHTML Validation.
注意:如果你要校验包含在框架内的页面,请确定你所设置的DTD为"FramesetDTD"。你可以阅读有关XHTML校验方面的信息。
Important: You cannot use the <body></body> tags together with the <frameset></frameset> tags! However, if you add a <noframes> tag containing some text for browsers that do not support frames, you will have to enclose the text in <body></body> tags!
重点:你不能在<frameset></frameset>标签里使用<body></body>标签!但是,当你要给那些无法支持框架的浏览器提示一些文字信息的话必须在<noframes>标签内使用<body>这里写提示的文字</body>标签
代码 | 输出 |
---|---|
<a href="planets.htm" target="_blank">看看页面的输出结果</a> The source code in "planets.htm": | 看看页面的输出结果 |
DTD indicates in which DTD the attribute is allowed. S=Strict, T=Transitional, and F=Frameset.
下表中的DTD列指明了被支持的DTD属性。S=Strict(精确的),T=Transitional(传统的),F=Frameset(框架)
属性 | 值 | 描述 | DTD |
---|---|---|---|
frameborder | 0 1 | Specifies whether or not to display border around the frame 指定是否显示框架边框 | F |
longdesc | URL | A URL to a long description of the frame contents. Use it for browsers that do not support frames 为框架里的内容加上一个URL进行详细的描述。可以为那些无法支持框架的浏览器使用这个属性 | F |
marginheight | pixels | Defines the top and bottom margins in the frame 定义框架里的上下边际 | F |
marginwidth | pixels | Defines the left and right margins in the frame 定义框架的左右边际 | F |
name | frame_name | Defines a unique name for the frame (to use in scripts) 定义框架的唯一name(可用于脚本) | F |
noresize | noresize | When set to noresize the user cannot resize the frame 当设置成noresize时用户就无法给框架重设大小了 | F |
scrolling | yes no auto | Determines scrollbar action 确定滚动条的作用 | F |
src | URL | Defines the URL of the file to show in the frame 定义框架内容的URL来源 | F |
Only allowed in XHTML 1.0 Frameset DTD!!
只有在XHTML1.0 Frameset DTD中才被允许!
id, class, title, style |
For a full description, go to Standard Attributes.
查看完整的属性
Vertical frameset
How to make a vertical frameset with three different documents.
怎样建立一个含有三个不同文档的垂直框架集。
Horizontal frameset
How to make a horizontal frameset with three different documents.
怎样建立一个含有三个不同文档的水平框架集。
Mixed frameset
How to make a frameset with three documents, and how to mix them in rows and columns.
建立一个含有三个同文档的混合框架(水平与垂直混合)
How to use the <noframes> tag
This example demonstrates how to use the <noframes> tag.
如何使用<noframes>标签
Frameset with noresize="noresize"
How to use the "noresize" attribute. The frames are not resizable. Move the mouse over the borders between the frames and notice that you can not move the borders.
怎样使用"noresize"属性。用鼠标移动相邻两框架的边框会发现不会发生变化。
Navigation frame
How to make a navigation frame. The navigation frame contains a list of links with the second frame as the target. The file called "tryhtml_contents.htm" contains three links. The source code of the links:
如何建立框架导航。其中的一个框架包含连接,另一个框架则显示连接的目标文档。包含连接的文件名为"tryhtml_content.htm"其中包含三个连接,它的代码如下:
<a href ="frame_a.htm" target ="showframe">Frame a</a><br>
<a href ="frame_b.htm" target ="showframe">Frame b</a><br>
<a href ="frame_c.htm" target ="showframe">Frame c</a>
The second frame will show the linked document.
第二个框架会显示目标文档
Jump to a specified section within a frame
This example demonstrates two frames. One of the frames has a source to a specified section in a file. The specified section is made with <a name="C10"> in the "link.htm" file.
在这个举例中将会有两个框架。其中的一个可以用来指定某文件的某一个位置。指定的位置是文件"link.html"中的一个锚点:<a name="C10">
Jump to a specified section with frame navigation
This example demonstrates two frames. The navigation frame (content.htm) to the left contains a list of links with the second frame (link.htm) as a target. The second frame shows the linked document. One of the links in the navigation frame is linked to a specified section in the target file. The HTML code in the file "content.htm" looks like this: <a href ="link.htm" target ="showframe">Link without Anchor</a><br><a href ="link.htm#C10" target ="showframe">Link with Anchor</a>.
这个举例中有两个框架,其中的一个含有指向内容页某一位置的连接,点击连接后另一个框架会显示内容页并直接显示出那个指定的位置。