可以使用 HTML 的 iframe 元素来嵌入其他网页或文档,下面是添加 iframe 元素的基本步骤:
<iframe>
标签来添加 iframe 元素。例如:<iframe src="http://example.com"></iframe>
src
属性中指定要嵌入的网页或文档的 URL。例如:<iframe src="http://example.com"></iframe>
width
和 height
属性中设置 iframe 元素的宽度和高度。例如:<iframe src="http://example.com" width="500" height="300"></iframe>
frameborder
属性中设置是否显示边框。例如:<iframe src="http://example.com" width="500" height="300" frameborder="0"></iframe>
scrolling
属性中设置是否显示滚动条。例如:<iframe src="http://example.com" width="500" height="300" frameborder="0" scrolling="no"></iframe>
下面是一个完整的例子:
<h3>使用 iframe 元素嵌入网页</h3>
<p>下面是一个嵌入了百度网页的 iframe 元素:</p>
<pre>
<code>
<iframe src="https://www.baidu.com" width="800" height="600" frameborder="0" scrolling="no"></iframe>
</code>
</pre>
<p>效果如下:</p>
<iframe src="https://www.baidu.com" width="800" height="600" frameborder="0" scrolling="no"></iframe>