浏览器窗口含有孤立的子窗口称为浮动框架
基本语法:
<iframe 属性名称="属性值" name="框架名称" src="资源路径"></iframe>
<a href="资源路径" target="属性值">链接标题</a>
a标签中target属性:
浮动框架属性:
样例代码:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>浮动框架应用</title>
<style type="text/css">
a{width: 300px; margin: 0 10px;}
h3{font-size: 28px; color: #00f; text-align: center;}
div{margin: 0 auto; text-align: center;}
</style>
</head>
<body>
<div>
<h3>浮动框架应用</h3>
<hr color="red">
<iframe name="leftiframe" src="https://www.tsinghua.edu.cn/" width="300px" height="300px"></iframe>
<iframe name="rightiframe" src="https://www.whu.edu.cn/" width="300px" height="300px"></iframe>
<p>
<a href="https://www.bilibili.com/" target="leftiframe">在左边浮动框架内显示B站官网</a>
<a href="https://www.csdn.net/" target="rightiframe">在右边浮动框架内显示csdn官网</a>
</p>
</div>
</body>
</html>
运行效果: