Html 框架(分上下区)例子

本文介绍如何利用HTML的frameset标签实现网页的多框架布局。通过设置rows属性可以将页面划分为不同区域,如顶部导航、主要内容区及底部等,并通过链接的目标属性(target)指定链接在哪个框架内加载。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 1. 用<frameset rows=*> 把网页分为了上下2个区:上面用作导航,下面是显示页面。
 index.html页面:主页将页面分为head和center两个部分。head作为导航,center为内容显示
<html>
<head><title>Frame测试index页面</title></head>
<frameset rows="15%,*" framespacing="0">
<frame src="head.html" noresize="noresize" name="head">
<frame src="center.html" noresize="noresize" name="center">
</frameset>
</html>
-------------------------------------------
 head.html页面:这个页面作为导航,要主意的是target属性是要跟index页面的frame里的name一样,href是你要在center显示的页面,显示的地方由target来决定。
<html>
<head><title>Frame测试head页面</title></head>
<body bgcolor="#EEEEEE">
<a href="http://www.baidu.com" target="center">百度一下</a><br/>
<a href="http://www.126.com" target="center">126邮箱</a>
</body>
</html>
------------------------------------
 center.html页面:center默认页面
<html>
<head><title>Frame测试center页面</title></head>
<body>
<h1>这是中间页面</h1>
</body>
</html>
提示:将内容拷贝到相应的页面。共有三个文件index.html、head.html、center.html
保存后打开运行index.html即可。

 

2. 分为上中下三个框架, 上层决定中层内容, 中层决定底层内容 。

  在index主页 修改
<frameset rows="15%,*,15%" framespacing="0">
<frame src="head.html" noresize="noresize" name="head">
<frame src="center.html" noresize="noresize" name="center">
<frame src="http://www.baidu.com" noresize="noresize" name="foot">
</frameset>
中层页面center加上连接
<a href="http://www.qq.com" target="foot">腾讯</a>

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值