iframe 用于在網頁內(nèi)顯示網頁。
添加 iframe 的語法
<iframe src="URL"></iframe>
URL 指向隔離頁面的位置。
Iframe - 設置高度和(hé)寬度
height 和(hé) width 屬性用于規定 iframe 的高度和(hé)寬度。
屬性值的默認單位是像素,但(dàn)也可(kě)以用百分比來設定(比如(rú) "80%")。
實例
<iframe src="demo_iframe.htm" width="200" height="200"></iframe>
Iframe - 删除邊框
frameborder 屬性規定是否顯示 iframe 周圍的邊框。
設置屬性值為(wèi) "0" 就可(kě)以移除邊框:
實例
<iframe src="demo_iframe.htm" frameborder="0"></iframe>
使用 iframe 作(zuò)為(wèi)鏈接的目标
iframe 可(kě)用作(zuò)鏈接的目标(target)。
鏈接的 target 屬性必須引用 iframe 的 name 屬性:
實例
<iframe src="demo_iframe.htm" name="iframe_a"></iframe>
<p><a href="http://www.mahapolo.com" target="iframe_a">W3School.com.cn</a></p>
HTML iframe 标簽
标簽 | 描述 |
---|---|
<iframe> | 定義內(nèi)聯的子窗口(框架) |