iframe用法

<iframe src="http://caiyanli.top/" height="500"  width="500" frameborder="0"

 marginheight="2" marginwidth="0" scrolling="yes"></iframe>

注:iframe h5 新增标签,元素会创建包含另外一个文档的内联框架(即行内框架)。

您可以把需要的文本放置在 <iframe> </iframe> 之间,这样就可以应对无法理解 iframe 的浏览器。

iframe属性和值和作用

 

属性

作用

frameborder

  • 1
  • 0

规定是否显示框架周围的边框。

height

  • pixels
  • %

规定 iframe 的高度。

longdesc

URL

规定一个页面,该页面包含了有关 iframe 的较长描述。

marginheight

pixels

定义 iframe 的顶部和底部的边距。

marginwidth

pixels

定义 iframe 的左侧和右侧的边距。

name

frame_name

规定 iframe 的名称。

sandbox

  • ""
  • allow-forms
  • allow-same-origin
  • allow-scripts
  • allow-top-navigation

启用一系列对 <iframe> 中内容的额外限制。

scrolling

  • yes
  • no
  • auto

规定是否在 iframe 中显示滚动条。

seamless

seamless

规定 <iframe> 看上去像是包含文档的一部分。

src

URL

规定在 iframe 中显示的文档的 URL

srcdoc

HTML_code

规定在 <iframe> 中显示的页面的 HTML 内容。

width

  • pixels
  • %

定义 iframe 的宽度。

 

代码:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>我的网页</title>
</head>
<body bgcolor="#ff9900">
<h1>我的网页</h1>
<hr>
<iframe src="http://caiyanli.top/" height="500" frameborder="0" marginheight="2" marginwidth="0" scrolling="yes">看不到我</iframe>
</body>
</html>

 

posted @ 2017-01-06 20:08  江山代有才人出  阅读(300)  评论(0编辑  收藏  举报
第一,有梦想。一个人最富有的时候是有梦想,有梦想是最开心的。第二,要坚持自己的梦想。有梦想的人非常多,但能够坚持的人却非常少。阿里巴巴能够成功的原因是因为我们坚持下来。在互联网激烈的竞争环境里,我们还在,是因为我们坚持,并不是因为我们聪明。有时候傻坚持比不坚持要好得多。——马云