Frames in HTML - Beginner Friendly Guide
What are Frames in HTML?
Frames in HTML are used to divide the browser window into multiple sections, and each section can load a
separate HTML page.
Why Were Frames Used?
- To show multiple web pages in one window.
- To keep a menu visible while browsing different content.
- To reduce reloading of entire pages.
Main Tags Used:
1. <frameset>: Replaces <body>, defines layout.
2. <frame>: Loads specific HTML pages.
3. <noframes>: For browsers that do not support frames.
Types of Frame Layouts:
1. Vertical Frames (Columns):
<frameset cols="30%, 70%">
<frame src="menu.html">
<frame src="content.html">
</frameset>
2. Horizontal Frames (Rows):
<frameset rows="20%, 80%">
<frame src="header.html">
<frame src="main.html">
</frameset>
3. Nested Frames (Combination of rows and columns):
<frameset rows="20%, 80%">
<frame src="top.html">
<frameset cols="30%, 70%">
<frame src="left.html">
<frame src="right.html">
</frameset>
</frameset>
Problems with Frames (Disadvantages):
- Difficult to bookmark exact content.
- Search engines can't index frames properly.
- Complex navigation and layout issues.
- Not supported in HTML5.
Modern Alternatives:
- CSS Flexbox and Grid for layouts.
- JavaScript and AJAX for dynamic content.
Note: Frames are outdated and not used in modern websites. They are mostly for learning or old systems.