2017-09-07
摘抄自W3school-HTML Iframe
希望幫助自己系統地打好基礎,也能在做筆記的同時添加一些自己額外的收獲。
添加 iframe 的語法
<iframe src="URL"></iframe>
URL 指向隔離頁面的位置。
Iframe - 設置高度和寬度
height 和 width 屬性用于規定 iframe 的高度和寬度。
屬性值的默認單位是像素,但也可以用百分比來設定(比如 "80%")。
<iframe src="demo_iframe.htm" width="200" height="200"></iframe>
Iframe - 刪除邊框
frameborder 屬性規定是否顯示 iframe 周圍的邊框。
設置屬性值為 "0" 就可以移除邊框:
<iframe src="demo_iframe.htm" frameborder="0"></iframe>
使用 iframe 作為鏈接的目標
iframe 可用作鏈接的目標(target)。
鏈接的 target 屬性必須引用 iframe 的 name 屬性:
<iframe src="demo_iframe.htm" name="iframe_a"></iframe>
<p><a target="iframe_a">W3School.com.cn</a></p>
讓鏈接在iframe中打開