HTML Frames

Frames

With frames, you can display more than one HTML document in the same browser window. Each HTML document is called a frame, and each frame is independent of the others.

The disadvantages of using frames are:

  • The web developer must keep track of more HTML documents
  • It is difficult to print the entire page

The Frameset Tag

  • The tag defines how to divide the window into frames
  • Each frameset defines a set of rows or columns
  • The values of the rows/columns indicate the amount of screen area each row/column will occupy

The Frame Tag

  • The tag defines what HTML document to put into each frame

In the example below we have a frameset with two columns. The first column is set to 25% of the width of the browser window. The second column is set to 75% of the width of the browser window. The HTML document "frame_a.htm" is put into the first column, and the HTML document "frame_b.htm" is put into the second column:




Note: The frameset column size value can also be set in pixels (cols="200,500"), and one of the columns can be set to use the remaining space (cols="25%,*").


Basic Notes - Useful Tips

If a frame has visible borders, the user can resize it by dragging the border. To prevent a user from doing this, you can add noresize="noresize" to the tag.

Add the tag for browsers that do not support frames.</p> <p><b>Important:</b> You cannot use the <body></body> tags together with the <frameset></frameset> tags! However, if you add a <noframes> tag containing some text for browsers that do not support frames, you will have to enclose the text in <body></body> tags! See how it is done in the first example below.</p><p> This example demonstrates how to make a navigation frame. The navigation frame contains a list of links with the second frame as the target. The file called "tryhtml_contents.htm" contains three links. The source code of the links:<br /><a href="frame_a.htm" target="showframe">Frame a</a><br /><br /><a href="frame_b.htm" target="showframe">Frame b</a><br /><br /><a href="frame_c.htm" target="showframe">Frame c</a><br />The second frame will show the linked document.</p><h2>Frame Tags</h2> <table class="ex" border="1" cellspacing="0" width="100%"> <tbody><tr> <th align="left">Tag</th> <th align="left">Description</th> </tr> <tr> <td><a href="http://www.w3schools.com/tags/tag_frameset.asp"><frameset></a></td> <td> Defines a set of frames</td> </tr> <tr> <td><a href="http://www.w3schools.com/tags/tag_frame.asp"><frame></a></td> <td> Defines a sub window (a frame)</td> </tr> <tr> <td><a href="http://www.w3schools.com/tags/tag_noframes.asp"><noframes></a></td> <td>Defines a noframe section for browsers that do not handle frames</td> </tr> <tr> <td><a href="http://www.w3schools.com/tags/tag_iframe.asp"><iframe></a></td> <td>Defines an inline sub window (frame)</td> </tr> </tbody></table> <div style='clear: both;'></div> </div> <div class='post-footer'> <div class='post-footer-line post-footer-line-1'><span class='post-icons'> <span class='item-control blog-admin pid-1833975000'> <a href='https://www.blogger.com/post-edit.g?blogID=786837436972712872&postID=4551179936341075072&from=pencil' title='Edit Post'> <img alt='' class='icon-action' height='18' src='https://resources.blogblog.com/img/icon18_edit_allbkg.gif' width='18'/> </a> </span> </span> </div> <div class='post-footer-line post-footer-line-2'><span class='post-labels'> Exercise <a href='https://onlinehtml.blogspot.com/search/label/HTML%20Frames' rel='tag'>HTML Frames</a> </span> </div> <div class='post-footer-line post-footer-line-3'></div> </div> </div> <div class='comments' id='comments'> <a name='comments'></a> </div> </div> </div></div> </div> <div class='blog-pager' id='blog-pager'> <span id='blog-pager-newer-link'> <a class='blog-pager-newer-link' href='https://onlinehtml.blogspot.com/2008/01/html-tables.html' id='Blog1_blog-pager-newer-link' title='Newer Post'>Newer Post</a> </span> <span id='blog-pager-older-link'> <a class='blog-pager-older-link' href='https://onlinehtml.blogspot.com/2008/01/html-links.html' id='Blog1_blog-pager-older-link' title='Older Post'>Older Post</a> </span> <a class='home-link' href='https://onlinehtml.blogspot.com/'>Home</a> </div> <div class='clear'></div> <div class='post-feeds'> </div> </div><div class='widget HTML' data-version='1' id='HTML7'> <div class='widget-content'> <div><script type="text/javascript">var addthis_pub="nomigobo";</script> <a onmouseover="return addthis_open(this, '', '[URL]', '[TITLE]')" onmouseout="addthis_close()" href="http://www.addthis.com/bookmark.php" onclick="return addthis_sendto()"><img border="0" width="83" alt="" style="border:0" src="https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_scED5S8oBKFahh9zbJ04-TsYkY8-Vp-Ni54Y8ILud2XWWjm58pMcnCYujPMueIrxlixpJAnyRElwzthxn6tuPik-DZepn2CtEvDiFI1NiVY5bKuA=s0-d" height="16"></a><script src="//s7.addthis.com/js/152/addthis_widget.js" type="text/javascript"></script></div> </div> <div class='clear'></div> </div><div class='widget HTML' data-version='1' id='HTML2'> <h2 class='title'>mixx it</h2> <div class='widget-content'> <a href="http://www.mixx.com/" onclick="window.location='http://www.mixx.com/submit?page_url='+window.location; return false;"> <img border="0" alt="Add to Mixx!" src="https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sqDWon3NylZlMm2iC0ngXqqCUCtdLTpjVPADELP6XtQU_2eMVCUOV3RGATG1GON4MN8ZxXis39qHozu20FOnj1IGcgZyDdDoArvVUeqjL1qM542XeCSw=s0-d"> </a> </div> <div class='clear'></div> </div></div> </div> <div id='ads-wrapper'> <div class='sidebar section' id='ads'><div class='widget AdSense' data-version='1' id='AdSense3'> <div class='widget-content'> <script type="text/javascript"><!-- google_ad_client="pub-3758486422209903"; google_ad_host="pub-1556223355139109"; google_ad_host_channel="00000"; google_ad_width=160; google_ad_height=600; google_ad_format="160x600_as"; google_ad_type="text_image"; google_color_border="FFFFFF"; google_color_bg="FFFFFF"; google_color_link="6699CC"; google_color_url="6699CC"; google_color_text="6699CC"; //--></script> <script type="text/javascript" src="//pagead2.googlesyndication.com/pagead/show_ads.js"> </script> <div class='clear'></div> </div> </div><div class='widget HTML' data-version='1' id='HTML5'> <div class='widget-content'> <!-- Search Google --> <center> <form action="http://www.google.com/custom" target="_top" method="get"> <table bgcolor="#ffffff"> <tr><td nowrap="nowrap" valign="top" height="32" align="left"> <a href="//www.google.com/"> <img border="0" alt="Google" src="//www.google.com/logos/Logo_25wht.gif" align="middle"></a> <br/> <label for="sbi" style="display: none">Enter your search terms</label> <input maxlength="255" id="sbi" value="" name="q" size="20" type="text"/> </td></tr> <tr><td valign="top" align="left"> <label for="sbb" style="display: none">Submit search form</label> <input id="sbb" value="Search" name="sa" type="submit"/> <input value="pub-3758486422209903" name="client" type="hidden"/> <input value="1" name="forid" type="hidden"/> <input value="ISO-8859-1" name="ie" type="hidden"/> <input value="ISO-8859-1" name="oe" type="hidden"/> <input value="GALT:#008000;GL:1;DIV:#FFFFFF;VLC:663399;AH:center;BGC:FFFFFF;LBGC:FFFFFF;ALC:0000FF;LC:0000FF;T:000000;GFNT:0000FF;GIMP:0000FF;FORID:1" name="cof" type="hidden"/> <input value="en" name="hl" type="hidden"/> </td></tr></table> </form> </center> <!-- Search Google --> </div> <div class='clear'></div> </div><div class='widget HTML' data-version='1' id='HTML1'> <div class='widget-content'> <a href="http://www.url-submitter.com/">URL Submitter</a> - Submit your URL to Search engines and Directories for FREE! </div> <div class='clear'></div> </div><div class='widget HTML' data-version='1' id='HTML3'> <h2 class='title'>FEEDJIT Live Traffic Feed</h2> <div class='widget-content'> <script src="//feedjit.com/serve/?bc=FFFFFF&amp;tc=494949&amp;brd1=336699&amp;lnk=494949&amp;hc=336699&amp;ww=160" type="text/javascript"></script><noscript><a href="http://feedjit.com/">Feedjit Live Blog Stats</a></noscript> </div> <div class='clear'></div> </div><div class='widget AdSense' data-version='1' id='AdSense5'> <div class='widget-content'> <script type="text/javascript"><!-- google_ad_client="pub-3758486422209903"; google_ad_host="pub-1556223355139109"; google_ad_host_channel="00000"; google_ad_width=200; google_ad_height=90; google_ad_format="200x90_0ads_al_s"; google_color_border="FFFFFF"; google_color_bg="FFFFFF"; google_color_link="336699"; google_color_url="336699"; google_color_text="336699"; //--></script> <script type="text/javascript" src="//pagead2.googlesyndication.com/pagead/show_ads.js"> </script> <div class='clear'></div> </div> </div></div> </div> <!-- spacer for skins that want sidebar and main to be the same height --> <div class='clear'> </div> </div> <!-- end content-wrapper --> </div> <div id='footer-wrapper'> <div class='footer section' id='footer'><div class='widget AdSense' data-version='1' id='AdSense2'> <div class='widget-content'> <script type="text/javascript"><!-- google_ad_client="pub-3758486422209903"; google_ad_host="pub-1556223355139109"; google_ad_host_channel="00000"; google_ad_width=728; google_ad_height=15; google_ad_format="728x15_0ads_al_s"; google_color_border="FFFFFF"; google_color_bg="FFFFFF"; google_color_link="336699"; google_color_url="336699"; google_color_text="336699"; //--></script> <script type="text/javascript" src="//pagead2.googlesyndication.com/pagead/show_ads.js"> </script> <div class='clear'></div> </div> </div></div> </div> </div> </div> <!-- end outer-wrapper --> <script type="text/javascript" src="https://www.blogger.com/static/v1/widgets/344097953-widgets.js"></script> <script type='text/javascript'> window['__wavt'] = 'APlU3lxDG34OCdYI8mqwKI34-oGh:1775687354611';_WidgetManager._Init('//www.blogger.com/rearrange?blogID\x3d786837436972712872','//onlinehtml.blogspot.com/2008/01/html-frames.html','786837436972712872'); _WidgetManager._SetDataContext([{'name': 'blog', 'data': {'blogId': '786837436972712872', 'title': 'Learn Online HTML Free', 'url': 'https://onlinehtml.blogspot.com/2008/01/html-frames.html', 'canonicalUrl': 'http://onlinehtml.blogspot.com/2008/01/html-frames.html', 'homepageUrl': 'https://onlinehtml.blogspot.com/', 'searchUrl': 'https://onlinehtml.blogspot.com/search', 'canonicalHomepageUrl': 'http://onlinehtml.blogspot.com/', 'blogspotFaviconUrl': 'https://onlinehtml.blogspot.com/favicon.ico', 'bloggerUrl': 'https://www.blogger.com', 'hasCustomDomain': false, 'httpsEnabled': true, 'enabledCommentProfileImages': true, 'gPlusViewType': 'FILTERED_POSTMOD', 'adultContent': false, 'analyticsAccountNumber': '', 'encoding': 'UTF-8', 'locale': 'en-US', 'localeUnderscoreDelimited': 'en', 'languageDirection': 'ltr', 'isPrivate': false, 'isMobile': false, 'isMobileRequest': false, 'mobileClass': '', 'isPrivateBlog': false, 'isDynamicViewsAvailable': true, 'feedLinks': '\x3clink rel\x3d\x22alternate\x22 type\x3d\x22application/atom+xml\x22 title\x3d\x22Learn Online HTML Free - Atom\x22 href\x3d\x22https://onlinehtml.blogspot.com/feeds/posts/default\x22 /\x3e\n\x3clink rel\x3d\x22alternate\x22 type\x3d\x22application/rss+xml\x22 title\x3d\x22Learn Online HTML Free - RSS\x22 href\x3d\x22https://onlinehtml.blogspot.com/feeds/posts/default?alt\x3drss\x22 /\x3e\n\x3clink rel\x3d\x22service.post\x22 type\x3d\x22application/atom+xml\x22 title\x3d\x22Learn Online HTML Free - Atom\x22 href\x3d\x22https://www.blogger.com/feeds/786837436972712872/posts/default\x22 /\x3e\n\n\x3clink rel\x3d\x22alternate\x22 type\x3d\x22application/atom+xml\x22 title\x3d\x22Learn Online HTML Free - Atom\x22 href\x3d\x22https://onlinehtml.blogspot.com/feeds/4551179936341075072/comments/default\x22 /\x3e\n', 'meTag': '', 'adsenseClientId': 'ca-pub-3758486422209903', 'adsenseHostId': 'ca-host-pub-1556223355139109', 'adsenseHasAds': true, 'adsenseAutoAds': false, 'boqCommentIframeForm': true, 'loginRedirectParam': '', 'isGoogleEverywhereLinkTooltipEnabled': true, 'view': '', 'dynamicViewsCommentsSrc': '//www.blogblog.com/dynamicviews/4224c15c4e7c9321/js/comments.js', 'dynamicViewsScriptSrc': '//www.blogblog.com/dynamicviews/5ddb33369fcd32d1', 'plusOneApiSrc': 'https://apis.google.com/js/platform.js', 'disableGComments': true, 'interstitialAccepted': false, 'sharing': {'platforms': [{'name': 'Get link', 'key': 'link', 'shareMessage': 'Get link', 'target': ''}, {'name': 'Facebook', 'key': 'facebook', 'shareMessage': 'Share to Facebook', 'target': 'facebook'}, {'name': 'BlogThis!', 'key': 'blogThis', 'shareMessage': 'BlogThis!', 'target': 'blog'}, {'name': 'X', 'key': 'twitter', 'shareMessage': 'Share to X', 'target': 'twitter'}, {'name': 'Pinterest', 'key': 'pinterest', 'shareMessage': 'Share to Pinterest', 'target': 'pinterest'}, {'name': 'Email', 'key': 'email', 'shareMessage': 'Email', 'target': 'email'}], 'disableGooglePlus': true, 'googlePlusShareButtonWidth': 0, 'googlePlusBootstrap': '\x3cscript type\x3d\x22text/javascript\x22\x3ewindow.___gcfg \x3d {\x27lang\x27: \x27en\x27};\x3c/script\x3e'}, 'hasCustomJumpLinkMessage': false, 'jumpLinkMessage': 'Read more', 'pageType': 'item', 'postId': '4551179936341075072', 'pageName': 'HTML Frames', 'pageTitle': 'Learn Online HTML Free: HTML Frames'}}, {'name': 'features', 'data': {}}, {'name': 'messages', 'data': {'edit': 'Edit', 'linkCopiedToClipboard': 'Link copied to clipboard!', 'ok': 'Ok', 'postLink': 'Post Link'}}, {'name': 'template', 'data': {'name': 'custom', 'localizedName': 'Custom', 'isResponsive': false, 'isAlternateRendering': false, 'isCustom': true}}, {'name': 'view', 'data': {'classic': {'name': 'classic', 'url': '?view\x3dclassic'}, 'flipcard': {'name': 'flipcard', 'url': '?view\x3dflipcard'}, 'magazine': {'name': 'magazine', 'url': '?view\x3dmagazine'}, 'mosaic': {'name': 'mosaic', 'url': '?view\x3dmosaic'}, 'sidebar': {'name': 'sidebar', 'url': '?view\x3dsidebar'}, 'snapshot': {'name': 'snapshot', 'url': '?view\x3dsnapshot'}, 'timeslide': {'name': 'timeslide', 'url': '?view\x3dtimeslide'}, 'isMobile': false, 'title': 'HTML Frames', 'description': 'Frames With frames, you can display more than one HTML document in the same browser window. Each HTML document is called a frame, and each...', 'url': 'https://onlinehtml.blogspot.com/2008/01/html-frames.html', 'type': 'item', 'isSingleItem': true, 'isMultipleItems': false, 'isError': false, 'isPage': false, 'isPost': true, 'isHomepage': false, 'isArchive': false, 'isLabelSearch': false, 'postId': 4551179936341075072}}]); _WidgetManager._RegisterWidget('_NavbarView', new _WidgetInfo('Navbar1', 'navbar', document.getElementById('Navbar1'), {}, 'displayModeFull')); _WidgetManager._RegisterWidget('_HeaderView', new _WidgetInfo('Header1', 'header', document.getElementById('Header1'), {}, 'displayModeFull')); _WidgetManager._RegisterWidget('_HTMLView', new _WidgetInfo('HTML6', 'sidebar', document.getElementById('HTML6'), {}, 'displayModeFull')); _WidgetManager._RegisterWidget('_HTMLView', new _WidgetInfo('HTML4', 'sidebar', document.getElementById('HTML4'), {}, 'displayModeFull')); _WidgetManager._RegisterWidget('_AdSenseView', new _WidgetInfo('AdSense1', 'sidebar', document.getElementById('AdSense1'), {}, 'displayModeFull')); _WidgetManager._RegisterWidget('_AdSenseView', new _WidgetInfo('AdSense4', 'main', document.getElementById('AdSense4'), {}, 'displayModeFull')); _WidgetManager._RegisterWidget('_BlogView', new _WidgetInfo('Blog1', 'main', document.getElementById('Blog1'), {'cmtInteractionsEnabled': false, 'lightboxEnabled': true, 'lightboxModuleUrl': 'https://www.blogger.com/static/v1/jsbin/2626028960-lbx.js', 'lightboxCssUrl': 'https://www.blogger.com/static/v1/v-css/828616780-lightbox_bundle.css'}, 'displayModeFull')); _WidgetManager._RegisterWidget('_HTMLView', new _WidgetInfo('HTML7', 'main', document.getElementById('HTML7'), {}, 'displayModeFull')); _WidgetManager._RegisterWidget('_HTMLView', new _WidgetInfo('HTML2', 'main', document.getElementById('HTML2'), {}, 'displayModeFull')); _WidgetManager._RegisterWidget('_AdSenseView', new _WidgetInfo('AdSense3', 'ads', document.getElementById('AdSense3'), {}, 'displayModeFull')); _WidgetManager._RegisterWidget('_HTMLView', new _WidgetInfo('HTML5', 'ads', document.getElementById('HTML5'), {}, 'displayModeFull')); _WidgetManager._RegisterWidget('_HTMLView', new _WidgetInfo('HTML1', 'ads', document.getElementById('HTML1'), {}, 'displayModeFull')); _WidgetManager._RegisterWidget('_HTMLView', new _WidgetInfo('HTML3', 'ads', document.getElementById('HTML3'), {}, 'displayModeFull')); _WidgetManager._RegisterWidget('_AdSenseView', new _WidgetInfo('AdSense5', 'ads', document.getElementById('AdSense5'), {}, 'displayModeFull')); _WidgetManager._RegisterWidget('_AdSenseView', new _WidgetInfo('AdSense2', 'footer', document.getElementById('AdSense2'), {}, 'displayModeFull')); </script> </body> </html>