HTML网页内联框架iframe
通过使用框架,你可以在同一个浏览器窗口中显示不止一个页面。
iframe语法:
<iframe src="URL"></iframe>
该URL指向不同的网页。
iframe - 设置高度与宽度
height 和 width 属性用来定义iframe标签的高度与宽度。
属性默认以像素为单位, 但是你可以指定其按比例显示 (如:“80%”)。
实例
<iframe loading="lazy" src="demo_iframe.htm" width="200" height="200"></iframe
iframe - 移除边框
frameborder 属性用于定义iframe表示是否显示边框。
设置属性值为 “0” 移除iframe的边框:
实例
<iframe src="demo_iframe.htm" frameborder="0"></iframe>
使用 iframe 来显示目标链接页面
iframe 可以显示一个目标链接的页面
目标链接的属性必须使用 iframe 的属性,如下实例:
实例
<iframe src="demo_iframe.htm" name="iframe_a"></iframe>
<p><a href="https://www.runoob.com" target="iframe_a" rel="noopener">RUNOOB.COM</a></p>
综合实例
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>内联框架iframe</title>
</head>
<body>
<!--iframe内联框架
<iframe src="path" 引用页面地址
name=“mainFrame" 框架标识名
w—h 宽度高度
</iframe>
-->
<iframe src="https://blog.csdn.net/qq_47897078?spm=1000.2115.3001.5343" width="1500px" height="500px" name="阿马的博客"></iframe>
<a href="https://blog.csdn.net/qq_47897078/article/details/121887918?spm=1001.2014.3001.5501" target="阿马的博客">点击跳转</a>
<!--
<iframe src="//player.bilibili.com/player.html?aid=55631961&bvid=BV1x4411V75C&cid=97257967&page=11"
scrolling="no"
border="0"
frameborder="no"
framespacing="0"
allowfullscreen="true">
</iframe>>
-->
</body>
</html>