通知短信+运营短信,5秒速达,支持群发助手一键发送🚀高效触达和通知客户 广告
# HTML &lt;frame&gt; 标签 ## 实例 简单的三框架页面: ``` <html> <frameset cols="25%,50%,25%"> <frame src="frame_a.htm" /> <frame src="frame_b.htm" /> <frame src="frame_c.htm" /> </frameset> </html> ``` ## 浏览器支持 | IE | Firefox | Chrome | Safari | Opera | | --- | --- | --- | --- | --- | 所有浏览器都支持 &lt;frame&gt; 标签。 ## 定义和用法 &lt;frame&gt; 标签定义 frameset 中的一个特定的窗口(框架)。 frameset 中的每个框架都可以设置不同的属性,比如 border、scrolling、noresize 等等。 ## HTML 与 XHTML 之间的差异 在 HTML 中,&lt;frame&gt; 标签没有结束标签。 在 XHTML 中,&lt;frame&gt; 标签必须被正确地关闭。 ## 提示和注释: 注释:如果您希望验证包含框架的页面,请确保 doctype 被设置为 "Frameset DTD"。阅读更多有关 [DOCTYPE](/tags/tag_doctype.asp "HTML &lt;!DOCTYPE&gt; 标签") 的内容。 重要事项:您不能与 &lt;frameset&gt;&lt;/frameset&gt; 标签一起使用 &lt;body&gt;&lt;/body&gt; 标签。不过,如果您需要为不支持框架的浏览器添加一个 &lt;noframes&gt; 标签,请务必将此标签放置在 &lt;body&gt;&lt;/body&gt; 标签中! ## 可选的属性 | 属性 | 值 | 描述 | | --- | --- | --- | | [frameborder](/tags/att_frame_frameborder.asp "HTML &lt;frame&gt; 标签的 frameborder 属性") | `0` `1` | 规定是否显示框架周围的边框。 | | [longdesc](/tags/att_frame_longdesc.asp "HTML &lt;frame&gt; 标签的 longdesc 属性") | _URL_ | 规定一个包含有关框架内容的长描述的页面。 | | [marginheight](/tags/att_frame_marginheight.asp "HTML &lt;frame&gt; 标签的 marginheight 属性") | _pixels_ | 定义框架的上方和下方的边距。 | | [marginwidth](/tags/att_frame_marginwidth.asp "HTML &lt;frame&gt; 标签的 marginwidth 属性") | _pixels_ | 定义框架的左侧和右侧的边距。 | | [name](/tags/att_frame_name.asp "HTML &lt;frame&gt; 标签的 name 属性") | _name_ | 规定框架的名称。 | | [noresize](/tags/att_frame_noresize.asp "HTML &lt;frame&gt; 标签的 noresize 属性") | noresize | 规定无法调整框架的大小。 | | [scrolling](/tags/att_frame_scrolling.asp "HTML &lt;frame&gt; 标签的 scrolling 属性") | `yes` `no` `auto` | 规定是否在框架中显示滚动条。 | | [src](/tags/att_frame_src.asp "HTML &lt;frame&gt; 标签的 src 属性") | _URL_ | 规定在框架中显示的文档的 URL。 | ## 标准属性 ``` id, class, title, style ``` 如需完整的描述,请访问[标准属性](/tags/html_ref_standardattributes.asp)。 ## TIY 实例 [垂直框架](/tiy/t.asp?f=html_frame_cols) 本例演示:如何使用三份不同的文档制作一个垂直框架。 ``` <html> <frameset cols="25%,50%,25%"> <frame src="/example/html/frame_a.html"> <frame src="/example/html/frame_b.html"> <frame src="/example/html/frame_c.html"> </frameset> </html> ``` [水平框架](/tiy/t.asp?f=html_frame_rows) 本例演示:如何使用三份不同的文档制作一个水平框架。 ``` <html> <frameset rows="25%,50%,25%"> <frame src="/example/html/frame_a.html"> <frame src="/example/html/frame_b.html"> <frame src="/example/html/frame_c.html"> </frameset> </html> ``` [如何使用 &lt;noframes&gt; 标签](/tiy/t.asp?f=html_noframes) 本例演示:如何使用 &lt;noframes&gt; 标签。 ``` <html> <frameset cols="25%,50%,25%"> <frame src="/example/html/frame_a.html"> <frame src="/example/html/frame_b.html"> <frame src="/example/html/frame_c.html"> <noframes> <body>您的浏览器无法处理框架!</body> </noframes> </frameset> </html> ``` [混合框架结构](/tiy/t.asp?f=html_frame_mix) 本例演示如何制作含有三份文档的框架结构,同时将他们混合置于行和列之中。 ``` <html> <frameset rows="50%,50%"> <frame src="/example/html/frame_a.html"> <frameset cols="25%,75%"> <frame src="/example/html/frame_b.html"> <frame src="/example/html/frame_c.html"> </frameset> </frameset> </html> ``` [含有 noresize="noresize" 属性的框架结构](/tiy/t.asp?f=html_frame_noresize) 本例演示 noresize 属性。在本例中,框架是不可调整尺寸的。在框架间的边框上拖动鼠标,你会发现边框是无法移动的。 ``` <html> <frameset cols="50%,*,25%"> <frame src="/example/html/frame_a.html" noresize="noresize" /> <frame src="/example/html/frame_b.html" /> <frame src="/example/html/frame_c.html" /> </frameset> </html> ``` [导航框架](/tiy/t.asp?f=html_frame_navigation) 本例演示如何制作导航框架。导航框架包含一个将第二个框架作为目标的链接列表。名为 "contents.htm" 的文件包含三个链接。 ``` <html> <frameset cols="120,*"> <frame src="/example/html/html_contents.html"> <frame src="/example/html/frame_a.html" name="showframe"> </frameset> </html> ``` [内联框架](/tiy/t.asp?f=html_iframe) 本例演示如何创建内联框架(HTML 页中的框架)。 ``` <html> <body> <iframe src="/i/eg_landscape.jpg"></iframe> <p>一些老的浏览器不支持 iframe。</p> <p>如果得不到支持,iframe 是不可见的。</p> </body> </html> ``` [跳转至框架内的一个指定的节](/tiy/t.asp?f=html_frame_jump) 本例演示两个框架。其中的一个框架设置了指向另一个文件内指定的节的链接。这个 "link.htm" 文件内指定的节使用 &lt;a name="C10"&gt; 进行标识。 ``` <html> <frameset cols="20%,80%"> <frame src="/example/html/frame_a.html"> <frame src="/example/html/link.html#C10"> </frameset> </html> ``` [使用框架导航跳转至指定的节](/tiy/t.asp?f=html_frame_navigation2) 本利演示两个框架。左侧的导航框架包含了一个链接列表,这些链接将第二个框架作为目标。第二个框架显示被链接的文档。导航框架其中的链接指向目标文件中指定的节。 ``` <html> <frameset cols="180,*"> <frame src="/example/html/content.html"> <frame src="/example/html/link.html" name="showframe"> </frameset> </html> ```