Part 11: Understanding HTML Frames
Senior Full-Stack Developer
A frameset document divides the browser window into multiple sections, each containing a separate HTML document.
<body> tag with <frameset><frame> or nested <frameset> elementsrows or cols attributesA standard HTML document contains a <body> element with content.
| Aspect | Frameset | Body |
|---|---|---|
| Structure | Divides window into frames | Single document |
| Content | Multiple HTML files | Single HTML file |
| URL | Shows frameset URL only | Shows current page URL |
| Bookmarking | Difficult | Easy |
| Modern Usage | Deprecated | Standard |
This would create a layout with:
Framesets use rows and cols attributes to define layout.
cols divides the window verticallyrows divides the window horizontallyNested framesets allow complex layouts by placing framesets inside other framesets.
This creates a layout with:
The <noframes> tag provides alternate content for browsers that don't support frames or have frames disabled.
<frameset> elementReasons to include <noframes> content:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN">
<html>
<head>
<title>3-Frame Layout Demo</title>
</head>
<frameset rows="80,*,60">
<!-- Header Frame -->
<frame src="header.html" name="header"
scrolling="no" noresize>
<!-- Middle Section with Navigation and Content -->
<frameset cols="200,*">
<!-- Navigation Frame -->
<frame src="navigation.html" name="nav">
<!-- Content Frame -->
<frame src="content.html" name="main">
</frameset>
<!-- Footer Frame -->
<frame src="footer.html" name="footer"
scrolling="no" noresize>
<noframes>
<body>
<h1>Frames Not Supported</h1>
<p>Your browser does not support frames.</p>
<p>Please <a href="no-frames.html">click here</a>
to view the non-frames version.</p>
</body>
</noframes>
</frameset>
</html>
<iframe> allows embedding another HTML document within the current document.
Modern CSS provides powerful layout options that replace frames.
SPAs load a single HTML page and dynamically update content.
You've learned HTML Frames
Fundamental structural differences
src, name, frameborder, scrolling, etc.
Creating layouts with framesets
Complex layouts with nested framesets
Fallback for non-supporting browsers
Practical implementation example
Create a frameset with the following structure:
Next: Learn about form elements, input types, and form validation