HTML Tags – Frame Tag


What is HTML <frame> tag ?

HTML <frame> tag defines the frame window.

HTML <frame> tag is used with the <frameset> element and <frameset> holds one or more <frame> elements.

HTML <frame> tag remove in HTML5 specification.

How HTML <frame> tag works ?

HTML <frameset> tag splits the browser window in several individual frames that can contain a separate HTML web document.

HTML <frameset> tag divides a webpage into multiple sections or frames, and each frame can contain different web pages.

And HTML <frame> is specific window or a frame, where we can load another web page.

We can use the “src” attribute to define the address of this web page.

A single web page can have several such frames.

Why HTML <frame> tag is used ?

HTML <frame> tag used improve appearance and usability of a site.

Note: HTML <frame> tag as it is not supported in HTML5, instead we can use <iframe> or <div> with CSS to achieve similar effects in HTML.


HTML beginners tutorial !!!

Click to Learn More about – HTML Tutorial for beginners

Syntax :

<frameset cols="50%,50%">
    <frame src="frame1.html" />
    <frame src="frame2.html" />
 </frameset>

Frame1.html


<html>
<body style="background-color:green;">
  <h2 align="center">Frame 1</h2>
</body>
</html>

Frame2.html

<html>
<body style="background-color:yellow;">
  <h2 align="center">Frame 2</h2>
</body>
</html>

Main.html

<!DOCTYPE html>
<html>
  <head>
    <title>Title of the document</title>
  </head>
  <frameset cols="50%,50%">
    <frame src="frame1.html">
    <frame src="frame2.html">
  </frameset>
</html>

Output :

<frame> Tag Attributes

HTML <frame> tag support following specific attributes. All following attributes has been removed in HTML5.

SnoAttributesValueDescription
1frameborder0
1
Specify whether display a border or not.
2longdescurlSpecify URL link to another page having a long description of the frame contents.
3marginheightpixel_sizeSpecify the top and bottom margins of frame.
4marginwidthpixel_sizeSpecify the left and right margins of frame.
5namenameSpecify the frame name.
6noresizenoresizeSpecify that prevents to resize frame.
7scrollingauto
yes
no
Specify weather scrollbars should be display or not.
8srcurlSpecify web document URL to show in a frame.

Global Attributes

HTML <frame> tag support following global attributes.

SnoAttributesValueDescription
1idunique_nameDeclared unique id for an element.
2classclass_nameDeclared one or more classnames for an element.
3stylestylesCSS inline styles specify an element.
4titletitleSpecify extra details of element contain, this will display as a “tooltip” for an elements.

Event Attributes

HTML <frame> tag does not support any event attributes.

Browser Compatibility

SnoBrowserSupport
1ChromeYes
2FirefoxYes
3EdgeYes
4OperaYes
5SafariYes
6Internet ExplorerYes