HTML入门基础(4)

一,框架(iframe)

1. 基本标签

属性描述
alignleft
right
top
middle
bottom
HTML5 不支持。HTML 4.01 已废弃。 规定如何根据周围的元素来对齐 <iframe>。
frameborder1
0
HTML5 不支持。规定是否显示 <iframe> 周围的边框。
heightpixels规定 <iframe> 的高度。
longdescURLHTML5 不支持。规定一个页面,该页面包含了有关 <iframe> 的较长描述。
marginheightpixelsHTML5 不支持。规定 <iframe> 的顶部和底部的边距。
marginwidthpixelsHTML5 不支持。规定 <iframe> 的左侧和右侧的边距。
namename规定 <iframe> 的名称。
sandboxNew""
allow-forms
allow-same-origin
allow-scripts
allow-top-navigation
对 <iframe> 的内容定义一系列额外的限制。
scrollingyes
no
auto
HTML5 不支持。规定是否在 <iframe> 中显示滚动条。
seamlessNewseamless规定 <iframe> 看起来像是父文档中的一部分。
srcURL规定在 <iframe> 中显示的文档的 URL。
srcdocNewHTML_code规定页面中的 HTML 内容显示在 <iframe> 中。
widthpixels规定 <iframe> 的宽度。

2. 基本语法

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

属性

属性描述
alignleft
right
top
middle
bottom
HTML5 不支持。HTML 4.01 已废弃。 规定如何根据周围的元素来对齐 <iframe>。
frameborder1
0
HTML5 不支持。规定是否显示 <iframe> 周围的边框。
heightpixels规定 <iframe> 的高度。
longdescURLHTML5 不支持。规定一个页面,该页面包含了有关 <iframe> 的较长描述。
marginheightpixelsHTML5 不支持。规定 <iframe> 的顶部和底部的边距。
marginwidthpixelsHTML5 不支持。规定 <iframe> 的左侧和右侧的边距。
namename规定 <iframe> 的名称。
sandboxNew""
allow-forms
allow-same-origin
allow-scripts
allow-top-navigation
对 <iframe> 的内容定义一系列额外的限制。
scrollingyes
no
auto
HTML5 不支持。规定是否在 <iframe> 中显示滚动条。
seamlessNewseamless规定 <iframe> 看起来像是父文档中的一部分。
srcURL规定在 <iframe> 中显示的文档的 URL。
srcdocNewHTML_code规定页面中的 HTML 内容显示在 <iframe> 中(就是在这个属性里面输入的HTML代码会在框架中显示)。
widthpixels规定 <iframe> 的宽度。

sandbox

描述
""启用所有限制条件
allow-same-origin允许将内容作为普通来源对待。如果未使用该关键字,嵌入的内容将被视为一个独立的源。
allow-top-navigation嵌入的页面的上下文可以导航(加载)内容到顶级的浏览上下文环境(browsing context)。如果未使用该关键字,这个操作将不可用。
allow-forms允许表单提交。
allow-scripts允许脚本执行。

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

效果:
在这里插入图片描述
在这里插入图片描述
代码:

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>框架</title>
</head>
<body>
<iframe src="1.jpg" frameborder="0"  width="250" height="370" name="1" align="middle"></iframe>
<p><a href="https://blog.csdn.net/pythonsnail/article/details/107272783" target="1">我的博客</a></p>
	
</body>
</html>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值