“HTML iframe”的版本间差异

本页内容
上一节: HTML_id_属性 下一节: HTML_Javascript
无编辑摘要
Neo讨论 | 贡献
无编辑摘要
 
(未显示同一用户的3个中间版本)
第1行: 第1行:
[[Category:HTML教程|32]]
HTML iframe 用于在网页中显示网页。
HTML iframe 用于在网页中显示网页。


第24行: 第26行:
<sample title="" hererun="s" desc="" >
<sample title="" hererun="s" desc="" >


<iframe src="https://www.xiaobai.wang" height="200" width="300"
<iframe src="https://www.xiaobai.wang/index.php?title=HTML_iframe" height="200" width="300"
   title="Iframe 示例"></iframe>  
   title="Iframe 示例"></iframe>  
</sample>
</sample>
第32行: 第34行:
<sample title="" hererun="s" desc="" >
<sample title="" hererun="s" desc="" >


<iframe src="https://www.xiaobai.wang" style="height:200px;width:300px;"
<iframe src="https://www.xiaobai.wang/index.php?title=HTML_iframe" style="height:200px;width:300px;"
   title="Iframe 示例"></iframe>  
   title="Iframe 示例"></iframe>  
</sample>
</sample>
第42行: 第44行:
<sample title="" hererun="s" desc="" >
<sample title="" hererun="s" desc="" >


<iframe src="https://www.xiaobai.wang" style="border:none;"
<iframe src="https://www.xiaobai.wang/index.php?title=HTML_iframe" style="border:none;"
   title="Iframe 示例"></iframe>  
   title="Iframe 示例"></iframe>  
</sample>
</sample>
第59行: 第61行:
<sample title="" hererun="s" desc="" >
<sample title="" hererun="s" desc="" >


  <iframe src="https://www.xiaobai.wang" name="iframe_a" title="iframe
  <iframe src="https://www.xiaobai.wang/index.php?title=HTML_iframe" name="iframe_a" title="iframe
   示例"></iframe>
   示例"></iframe>




  <p><a href="https://www.xiaobai.wang" target="iframe_a">W3Schools.com</a></p>
  <p><a href="https://www.xiaobai.wang/index.php?title=HTML_iframe" target="iframe_a">xiaobai.wang</a></p>
   
   
</示例>
</sample>

2022年8月6日 (六) 19:36的最新版本


HTML iframe 用于在网页中显示网页。

<iframe> 标记指定一个内联框架。

内联框架用于在当前 HTML 文档中嵌入另一个文档。


示例

语法

<iframe src="url" title="描述"></iframe>

提示:最好始终 title 包含 <iframe> . 屏幕阅读器使用它来读取 iframe 的内容。

iframe - 设置高度和宽度

使用 height width 属性指定 iframe 的大小。

默认情况下,高度和宽度以像素为单位指定:


示例

<iframe src="https://www.xiaobai.wang/index.php?title=HTML_iframe" height="200" width="300"
  title="Iframe 示例"></iframe>

或者您可以添加 style 属性并使用 CSS height width 属性:


示例

<iframe src="https://www.xiaobai.wang/index.php?title=HTML_iframe" style="height:200px;width:300px;"
  title="Iframe 示例"></iframe>

iframe - 移除边框

默认情况下,iframe 周围有边框。

要移除边框,请添加 style 属性并使用 CSS border 属性:


示例

<iframe src="https://www.xiaobai.wang/index.php?title=HTML_iframe" style="border:none;"
  title="Iframe 示例"></iframe>

使用 CSS,您还可以更改 iframe 边框的大小、样式和颜色:


示例

<iframe src="https://www.xiaobai.wang" style="border:2px solid red;"
  title="Iframe 示例"></iframe>

Iframe - 链接目标

iframe 可用作链接的目标框架。

链接的 target 属性必须引用 name iframe 的属性:


示例

<iframe src="https://www.xiaobai.wang/index.php?title=HTML_iframe" name="iframe_a" title="iframe
  示例"></iframe>


 <p><a href="https://www.xiaobai.wang/index.php?title=HTML_iframe" target="iframe_a">xiaobai.wang</a></p>
上一节: HTML_id_属性 下一节: HTML_Javascript
此页面最后编辑于2022年8月6日 (星期六) 19:36。