HTML allows programmers to divide a single browser display into multiple window sections, where each section can 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 learn about the frames and how they are used to create multiple sections in a single browser display.



The HTML font tag is obsolete and is not supported in HTML5.

HTML frameset Tag

This tag defines a specific window or frame inside the <frameset> tag. Every <frame> within the <frameset> tag may use attributes for different purposes like border, resizing capability, include scrolling, etc. The primary use of these frames was to display a menu in parts of the page with content in one part of the page. Multiple HTML pages can be viewed in a browser window using this tag. Let's see how:

Example:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>

    <head>
        <title>Example for Frame</title>
    </head>
        
    <frameset cols="20%,*">
                <frame src="frame1.html"> 1st FRAME
                <frame src="frame2.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:

  • Small devices (mobile or other smartphones) cannot cope with the size and features of frames mostly because these device screens aren't large enough to split 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 specifying the frame borders width spacing on the left and right sides. It takes the value in pixels.
  • marginheight: facilitates specifying the frame borders height spacing on top and bottom sides. It also takes the value in pixels.
  • noresize: It is generally possible to resize your frame 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.


Found This Page Useful? Share It!
Get the Latest Tutorials and Updates
Join us on Telegram