Frames and framesets
Attention: Since the latest HTML version, HTML5, framesets and frames are considered unwanted elements that you shouldn’t use anymore. At the end of this article, we present modern alternatives to the use of frames.
Introduction and History
Framesets and frames originate from the early years of website design. The frame feature, introduced by Netscape in 1996, made it possible to divide a website into different sections. Originally the frameset was used to separate the header and navigation bar of a page from its content. This separation of static parts - navigation and header - from dynamic parts was useful at that time because the internet connection of most users was very limited and the speed was only a fraction of the data transfer rates available today. Therefore, an attempt was made to reload only certain parts of a website, namely those that change while the static parts remain unchanged. This saved data volume and reduced loading time.
A frameset is the layout of a web page and is stored in its own HTML file. It contains the number of individual sections as well as the number and size of rows and columns. The corresponding HTML element is called "frameset" and can contain the attributes "cols" and "rows". “cols" defines the number of columns and "rows" the number of rows. The individual columns are separated by a comma. It is possible to format one or more columns or rows "dynamically", i.e. one or more rows adapt to the size of the fixed columns or rows. With col="400,*" you create a frameset with two columns, where the first column is 400 pixels wide and the second column takes up the rest of the frame. The number and size of the rows are defined analogously to the columns. The resulting fields are then filled using HTML.
A frame is the core of a frameset page. The "frame" element may not be closed by a closing element, but only "inline", i.e. by "/>" at the end of the opening element. In addition, the frame element may only be used within a frameset.
The two main attributes of a frame are "src" and "name". src" defines the content page to be loaded into the frame. This works the same as with other tags, such as "img". The "name" attribute serves as a destination for links and is therefore essential for navigation. Apart from these two HTML attributes, the following are allowed in a frame element: id, class, style, title, longdesc, frameborder, marginwidth, marginheight, noresize and scrolling. The HTML attributes frameborder, noresize, and scrolling are specific to the frame element. With "frameborder" you can define a frame for an element, but not all possibilities of CSS are available here. Noresize determines whether users have the option to enlarge or reduce the frame element. With the scrolling attribute, you can define whether a frame contains a scrollbar or not.
Disadvantages of frames
The disadvantages of frames are manifold. In this section, we will present some of them.
First of all, framesets and frames originate from a time when most providers did not yet offer a dynamic creation of websites through the use of server-side programming languages. As this is the case today, the classic use case of frames in HTML no longer exists. However, the disadvantages remain. Since the browser always displays the entire construct and the URL does not change when navigating the page, separating it into several documents means that users cannot bookmark subpages. In addition, frames make the printing of complete pages more cumbersome.
A particularly annoying disadvantage of frames is that page content found via search engines is displayed without the corresponding navigation. in the worst case, users see only the content of the frame without neighboring elements. In the age of smartphones, tablets and the like, the fact that frames cannot be positioned with CSS is also an unacceptable disadvantage that makes it almost impossible to use frame pages on mobile devices.
Importance of frames for SEO
Check if there are frames on your web page
Modern replacements for frames
In summary: Frames and framesets FAQs
What are frames and framesets used for in HTML?
Frames and framesets are a technique that allows you to divide a page into static and dynamic elements. If a user refreshes the page, the browser reloads only the dynamic parts.
What is the difference between a frame and a frameset?
Frame describes the single element a page consists of. The frameset contains the individual frames.
What are the disadvantages of frames?
Dividing a page into multiple documents keeps users from bookmarking individual subpages. Another disadvantage is the fact that you cannot position frames using CSS.
Should you still use frames and framesets?
No. HTML5 does not support frames and framesets and no longer recommends using them.
What are alternatives to frames?
A more modern approach is the iframe element. You can also use CSS or AJAX to reach similar results.