What is Frame?
Frames Tag in HTML enables the user to divide a page into a number of rectangular regions of various sizes. A frame is a window within another window. A page can have one or more frames. A-frames is a website itself i.e. it can access different URLs and can be updated independently.
What is Frameset Tag?
The frameset element allows an author to define a multiple-frame web page, where each frame displays its own HTML document frames can be scrolled & U-sized by the uses. This tag replaces the body tag completely to create frames style pages.
Syntax – <frameset rows=”n, n”> ————-</frameset>
The frameset tag can have two attribute rows & columns.
Rows
Specify the no of horizontal windows or frames. The value of the row attribute specifies the height frames in the frameset.
Columns
Specify no. of vertical windows or frames. The value then specifies the width of the frames in the frameset.
The value of these two attributes can be impressed using one of the following ways-
- In pixel or absolute dimension-
Syntax-
<frameset rows=”150, 400”>———————</frameset>
Defines 2 rows with the top row being 150 pixels high & the bottom row being 400 pixels high.
- As percentage of its parent frame- We can define columns & rows as percentage of the total height & width of the browser windows
Example-
<frameset rows=”80%, 20%”>
. Defines 2 rows top filling 80% of the browser window & bottom filling 20% of the total height of the browser window.
Relative dimension-
Syntax-
<frameset rows=200, 40%, *>——————-</frameset>
Defines the top row is 200 pixels & second is 40% of the window & third occupied the rest of the window spaces.
Frame tag
The frame element is nested inside the frameset element. It is used to define frames that are included in the frameset.
<frame name=”frame name”, src= URL frame border=”1”, margin height=”pixels”, margin width=”pixels”, nosize, scrolling=“yes/no/auto”>
Here frame border margin height, margin width, no size, scrolling is optional.
Name- The name attribute of the frame tag specifies the name of the frame. So, it can be got from the hypertext links located in other frames.
SRC- Defines the source file for the images when the attribute to type is set to images.
Frame border- Turns the border of a frame-off or on [0 for off and/ for on [default]]
Margin height & width- Set the amount of left, right, top and bottom, margin spaces in the frame(value is “2”)
No size- Stops the manual resizing of the frame.
Scrolling- Determines row scroll bar which is treated in a frame.
- No- It turns off the scroll bar display even if the document extends keyword the dimension of the frames.
- The default scrolling attribute value is “auto” will automatically cause scroll bar to be added to the frame if they required.
Nested Frames in HTML
The frameset tag will display only with. The columns & row attribute in order to have the attributes together the frameset tag has to be placed with other frameset tags.
Syntax-
<frameset rows = ”50%, 50%“>
<frame src = “abcd.html“>
<frameset cols = “*, *“>
<frame src = “pqr.html“>
<frame src = “xyz.html“>
</frameset>
</frameset>

Output

Here the main window will be split into two horizontal frames & the second horizontal frame will be divided into two vertical frames.