Difference between revisions of "Frames and framesets"

From Seobility Wiki
Jump to: navigation, search
Line 1: Line 1:
<seo title="Frames and framesets (HTML tags)" metadescription="Frame and frameset are HTML tags that are used to divide a website into different sections. Since HTML 5, they are considered unwanted elements." />
+
<seo title="Frames and Framesets (HTML Tags)" metadescription="Frame and frameset are HTML tags that are used to divide a website into different sections. Since HTML 5, they are considered unwanted elements." />
  
 
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.
 
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.

Revision as of 10:50, 11 June 2021

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.

Framesets

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.

Frames

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

Most search engines, including Google, only pay attention to the "noframes" area on pages with a frameset, which means that a classic frame page cannot be indexed. To prevent the display of content without an appropriate navigation, a JavaScript snippet can be used, but basically, we strongly advise you against the use of frames. If a website designed with this technology is to be optimized, we recommend an immediate redesign that takes into account the use of mobile devices.

Frameset Checker

Check if there are frames on your web page

Modern replacements for frames

HTML5 does not support frames and they should not be used. If you cannot avoid embedding some elements or documents, it is better to use the iframe element in the HTML code. This element is a successor of the frame element, which is often used for the integration of videos. If you only want to get a fixed navigation and thus prevent scrolling to it, you can implement an XHTML and HTML5 compatible solution with CSS and the "position: fixed" attribute. In addition, AJAX, a combination of JavaScript and XML, offers the possibility to dynamically load and adapt individual elements and content on a website.

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.

Related links