10004---HTML框架(iframe与framset,frame)

iframe:内联框架
frameset,frame:框架


通过使用框架,你可以在同一个浏览器窗口中显示不止一个页面。

iframe语法:

<strong><iframe src="URL"></iframe> </strong>

该URL指向不同的网页。

iframe - 设置高度与宽度

height 和 width 属性用来定义iframe标签的高度与宽度。

属性默认以像素为单位, 但是你可以指定其按比例显示 (如:"80%").

<iframe src="demo_iframe.htm" width="200" height="200"></iframe>
iframe - 移除边框

frameborder 属性用于定义iframe表示是否显示边框。

设置属性值为 "0" 移除iframe的边框:

<iframe src="demo_iframe.htm" frameborder="0"></iframe>

使用iframe来显示目录链接页面

iframe可以显示一个目标链接的页面。

目标链接的属性必须使用iframe的属性,如下实例:

<iframe src="demo_iframe.htm" name="iframe_a"></iframe>
 <p><a href="http://www.runoob.com" target="iframe_a">RUNOOB.COM</a></p> 

所有浏览器都支持 <frameset> 标签。

垂直框架:

<!doctype html>
<html>
	<frameset cols="33%,33%,33%">
		<frame src="http://www.sohu.com" frameborder="0">
		 <frame src="http://www.163.com" frameborder="0">
		 <frame src="http://www.sina.com.cn" frameborder="0">
	</frameset>
</html>


定义和用法

frameset 元素可定义一个框架集。它被用来组织多个窗口(框架)。每个框架存有独立的文档。

在其最简单的应用中,frameset 元素仅仅会规定在框架集中存在多少列或多少行。您必须使用 cols 或 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>

混合框架

<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>

导航框架

导航框架包含一个将第二个框架作为目标的链接列表。名为 "contents.htm" 的文件包含三个链接。
 

<strong><html>
    <frameset cols="120,*">
      <frame src="/example/html/html_contents.html">
      <frame src="/example/html/frame_a.html" name="showframe">
    </frameset>
</html></strong>

contents.htm:

<html>
<body>
 <a href ="/example/html/frame_a.html" target ="showframe">Frame a</a><br />
 <a href ="/example/html/frame_b.html" target ="showframe">Frame b</a><br />
 <a href ="/example/html/frame_c.html" target ="showframe">Frame c</a>
</body>
</html>




  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值