HTML frame

HTML Frames

By using frames, you can display more than one page in the same browser window.

Frame tagiframe


##iframe syntax :

#<iframe src="URL"> </iframe>

This URL points to a different web page. You can also point to a specific HTML file


Iframe - Set height and width


height and width attributes are used to define the height and width of the iframe tag.

The property is in pixels by default, but you can specify that it is displayed proportionally (e.g.: "80%").

Example

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>php中文网(php.cn)</title>
</head>
<body>
<iframe src="second.html" width="400" height="200"></iframe>
<iframe src="http://ask.php.cn/" width="400" 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 iframe border:

Example

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>php中文网(php.cn)</title>
</head>
<body>
<iframe src="http://www.php.cn/" width="200" height="200" frameborder="0">
    <p>您的浏览器不支持  iframe 标签。</p>
</iframe>
</body>
</html>
Run this Section program to see what is different from the above program



##

Use iframe to display directory link page

iframe can display a target link page

The 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中文网(php.cn)</title>
</head>
<body>
<iframe src="http://www.php.cn" name="iframe_a"></iframe>
<p><a href="http://www.php.cn" target="iframe_a">php.cn</a></p>
</body>
</html>

Run the program and click to see


HTML iframe tag

Tag Description
<iframe> Define an inline iframe



##

Continuing Learning
||
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>php中文网(php.cn)</title> </head> <body> <iframe src="http://www.php.cn/" width="400" height="200"></iframe> <iframe src="http://ask.php.cn/" width="400" height="200"></iframe> <p>一些旧的浏览器不支持 iframe。</p> <p>如果浏览器不支持 iframes 则不会显示。</p> </body> </html>
submitReset Code