一、<iframe>
标签:规定一个内联框架。
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>W3Cschool在线教程(w3cschool.cn)</title>
</head>
<body>
<iframe src="/statics/demosource/demo_iframe.htm" name="iframe_a"></iframe>
<p><a href="https://www.w3cschool.cn" target="iframe_a">W3CSCHOOL.CN</a></p>
<p><b>注意:</b> 因为 a 标签的 target 属性是名为 iframe_a 的 iframe 框架,所以在点击链接时页面会显示在 iframe框架中。</p>
</body>
</html>
iframe 标准属性
属性 | 说明 |
---|---|
class | 规定元素的类名(classname) |
id | 规定元素的唯一 id |
style | 规定元素的行内样式(inline style) |
title | 规定元素的额外信息(可在工具提示中显示) |
二、HTML <frameset>标签 - HTML5 不支持
<frameset>
标签在一个页面中设置一个或多个框架,用<frameset>
</frameset>
代替了<body>
</body>
,不能出现在body
标签里。
<frameset>语法:
<html>
<head></head>
<frameset>
<frame src="menu.html">
<frame src="content.html">
</frameset>
</html>
frameset
- 建立框架的标记,将在其中定义各个框架。frame src
- 指示框架显示内容URL地址。