HTML <frame>
Tag
The <frame>
tag in HTML is used to define a particular area in which another HTML document can be displayed. This tag is commonly used within framesets to divide a webpage into multiple frames, each displaying a separate HTML document.
How <frame>
Works:
When the <frame>
tag is used within a <frameset>
element, it specifies the location and size of the frame within the frameset. The <frame>
tag can also be used on its own, but it is mostly used in conjunction with other frames to create a multi-frame layout.
Main Attributes of <frame>
Tag:
Attribute | Description |
---|---|
src |
Specifies the URL of the document to be displayed in the frame. |
name |
Defines a unique name for the frame that can be used as a target for links. |
border |
Specifies the width of the border around the frame. |
noresize |
Prevents the user from resizing the frame. |
scrolling |
Controls whether scrollbars are displayed in the frame. |
Examples:
Here is an example code snippet showing how the <frame>
tag can be used within a frameset:
<frameset cols="25%,75%">
<frame src="menu.html" name="menu" noresize>
<frame src="content.html" name="content">
</frameset>
In this example, the webpage is divided into two frames - one displaying the menu.html
document and the other displaying the content.html
document.
When specifying the attributes of the <frame>
tag, make sure to include the necessary attributes such as src
, name
, and any other attributes required for your specific layout.