HTML provides programmers for dividing a single browser display into multiple window sections, where each section holds the capability to load individual URLs. This concept of HTML providing multiple frames at one browser display is called frameset, and all the frame tags are used within the container tag <frameset>. So the entire separation of HTML pages is possible using the concept of frames. In his chapter, you will be learning about the frames and how they are used for creating multiple sections in a single browser display.
HTML frameset Tag
This tag is used for defining a specific window or frame inside the <frameset> tag. Every <frame> within the <frameset> tag may use attributes for different purpose like: border, resizing capability, include scrolling etc. The main use of frames is for displaying menu(s) in any portion of your page along with the content in another part of the page. Multiple HTML pages can be seen within the single vide-port of the browser window using this tag. Let's see how:
<html> <head> <title>Example for Frame</title> </head> <frameset cols="20%,*"> <frame src="Ol.html"> 1st FRAME <frame src="marquee.html"> 2nd FRAME </frameset> </html>
Drawbacks of Frames
Using frames has some disadvantages, so it is not recommended to use frames in the HTML document. These are:
- There are small devices (mobile or other smartphones) that cannot cope with the size and features of frames mostly because these device-screens aren't large enough for making this splitting up, which is done by <frame>.
- Screen resolution has an adverse effect on frames that you will create in some devices.
- In many cases, the back button of the browser may also stop working.
- In many browsers, frame technology is not supported, and hence HTML script is unable to relay any output in the browser.
Various Attributes of <frame> tag
- src: is implemented for fetching the HTML file that needs to be loaded in one of the frames. It takes the value as filename.html or filename.htm within double-quotes.
- name: facilitates you in giving a name to your frame, and hence you can indicate which frame(s) you are supposed to load into your page.
- frameborder: is used for specifying if the borders are being shown in the frame you are using, and you can assign values either: 1 (yes) or 0 (no) for it.
- marginwidth: facilitates in specifying the frame borders width spacing in the left and right sides. It takes the value in pixels.
- marginheight: facilitates in specifying the frame borders height spacing in top and bottom sides. It also takes the value in pixels.
- noresize: In general, it is possible to resize your frame just by clicking and dragging the frame borders. But this attribute helps users stop resizing the frames. It is written something like: noresize = "noresize".
- scrolling: is used for activating and deactivating the scroll-bar appearance in your frame and takes either yes, no, or auto as values to be assigned to it within double-quotes.