HTML frame
HTML frame
Definition and usage
<frame> tag defines a specific window (frame) in the frameset.
Each frame in the frameset can set different properties, such as border, scrolling, noresize, etc.
Differences between HTML and XHTML
In HTML, the <frame> tag does not have a closing tag.
In XHTML, the <frame> tag must be closed properly.
Tips and Notes:
Note: If you wish to validate pages containing frames, make sure the doctype is set to "Frameset DTD". Read more about DOCTYPE.
Important: You cannot use the <body></body> tag with the <frameset></frameset> tag. However, if you need to add a <noframes> tag for browsers that don't support frames, be sure to place the tag within the <body></body> tag!
Iframe - Set height and width
##The height and width attributes are used to define the height and width of the iframe tag. The property defaults to pixels, but you can specify that it be displayed proportionally (e.g.: "80%").<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>PHP中文網(wǎng)</title> </head> <body> <iframe src="demo_iframe.htm" width="200" height="200"></iframe> <p>一些舊的瀏覽器不支持 iframe。</p> <p>如果瀏覽器不支持 iframes 則不會顯示。</p> </body> </html>
Iframe - Remove borders
The frameborder attribute is used to define whether the iframe indicates whether to display the border. Set the attribute value to "0" to remove the border of the iframe:<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>PHP中文網(wǎng)</title> </head> <body> <iframe src="http://www.php.com" width="200" height="200" frameborder="0"> <p>您的瀏覽器不支持 iframe 標(biāo)簽。</p> </iframe> </body> </html>
Use iframe to display the directory link page
iframe can display a target link pageThe attributes of the target link must use the attributes of iframe, as shown in the following example:<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>PHP中文網(wǎng)</title> </head> <body> <iframe src="demo_iframe.htm" name="iframe_a"></iframe> <p><a href="http://www.php.com" target="iframe_a">php.cn</a></p> <p><b>注意:</b> 因為 a 標(biāo)簽的 target 屬性是名為 iframe_a 的 iframe 框架,所以在點擊鏈接時頁面會顯示在 iframe框架中。</p> </body> </html>