HTML Tutorial - Working with Frames
(Page 7 of 12 )
You can divide your browser window into two or more by applying frames. You can create any number of frames you require. They are created using <FRAMESET> tag. This tag helps you to specify the division, rows (ROWS Attribute) or columns (COLS Attribute) of the Window. In order to create frames, you should have a minimum of two html files. The paths to these files are specified using <FRAME> tag’s src attribute as shown in the listing given below:
Listing 16
<FRAMESET rows = "10%,*">
<FRAME src = "first.html">
<FRAME src = "second.html">
<FRAMESET>
The above creates a frame of rows. The first.html file occupies the first 10% and remaining space will be occupied by second.html file. Keep in mind that if you try to insert <BODY> tag, the frame will not appear on the screen.
Attributes used with Frameset Tag
- Cols: To divide the window into columns.
- Bordercolor: Changes the border color of the frame border.
- Frameborder: The values can be 0 or 1. The frame border will be invisible if you apply 0. This attribute is applied on majority of sites to make the appearance perfect.
Attributes used with Frame Tag
- noresize: By specifying this attribute, the frame border will not be resizable. Users can’t resize the window using their mouse.
- Scrolling: The values are Yes / No. If No, scrollbars will not appear. By default, scrollbars will appear. If the content is less, you can apply this attribute.
Advanced Usage of Frames
One of the advanced usages of frames is its Nesting. Here, two rows are created and the bottom frame is divided into two columns. Like this we can apply any number of frames, provided each such frame can accommodate relevant HTML files. However, I recommend you restrict the frame divisions so that the web page looks neat and is easier to navigate. Try out the code given below:
Listing 17
<FRAMESET rows = "50%,*">
<FRAME src = "first.html">
<FRAMESET cols = "20%,*">
<FRAME src = “second.html”>
<FRAME src = "third.html">
<FRAMESET>
<FRAMESET>
In the above code, a row frame is created with equal portion and the second row is divided into two-column frame. Be sure to create these three html files before viewing the output. Otherwise, you will get error messages.
Next: Using Forms, Text, Buttons, and Combo Box >>
More HTML Articles
More By Anand Narayanaswamy
|
| · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | | |
|