HTML Frames

Here’s some old thoughts about the use of frames in HTML

I found some notes about HTML frames written some time ago.

Once upon a time long ago… frames were used regularly on websites.

Using frames we are able to divide web page into two or more areas. This can be by fixed width of percentage.

One of the main reasons for the use of frames was to provide distinct content within different areas of the page. Frames enable the website’s navigation to be shown

Often the navigation was positioned on the left of the page with the content on the right. When one of the navigation links was clicked only the content area changed.

To create our HTML page using frames we need a master page, typically index.html which will look something like:

<frame src="Nav_page.html">
<frame src="content_page.html">

In the example above the defined widths of the two frame areas are one of 150 pixels and the othereverything else.

The two other web pages referenced are created in the usual way.

Attributes of the FRAME tag are:

frameborder1 or 0Determines whether frames are displayed with a border.
marginwidthAn integer valueThe height of the left and right margins in pixels.
marginheightAn integer valueThe width of the top and bottom margins in pixels.
nameA string beginning with a letterIdentifies the frame. This is relevant for JavaScript to be able to reference the frame.
noresizeWhen set it prevents the user from resizing the frame.
scrollingyes, no, autoSpecifies whether scroll bars shall be displayed. When Auto is specified the scrollbar is added if required.
srcany URLSpecifies the file to be displayed in the frame. If no file is given the frame will be left blank.

The frames approach has historically been a problem for search engines to index. Also if the visitor arrives on a content page a means of viewing the complete arrangement of navigation and content must be supplied.

Often frames will be flagged as a potential security issue. The content of a frame may be a different website and can therefore be changed to a website other than the one intended.

And today what about the use of frames today?

Frames are not supported in HTML5.