Little Web Hut

HTML 4.01 and XHTML 1.0 Reference: <frame> Tag

The <frame> tag is allowed in DTD Frameset documents but not Transitional or Strict documents.
HTML <frame> Tag
Syntax HTML syntax - This element does not require a closing tag.
<frame>

XHTML syntax - This element is opened and closed, within a single tag, by adding a space followed by a forward slash at the end of the tag.
<frame />
Usage The <frame> tag is used to specify the contents of a frame within a frameset. The <frame> tag can also specify the appearance of the frame.

The <frameset> tag can be used to divide the display into multiple frames. Each of the separate frames can display its own web page. The <frame> tag is used to specify the URL of the web page that will be displayed in a frame. One <frame> tag is used for each URL.

HTML <frame> tag example using the src attribute.
<html>

<head>
 <title>HTML Test</title>
</head>

<frameset cols="40%,60%">
 <frame src="../html/div_tag/" title="sample frame">
 <frame src="../html/span_tag/" title="sample frame">
</frameset>
<noframes></noframes>

</html>
Test It HTML Style

XHTML <frame> tag example using the src attribute.
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
 <title>HTML Test</title>
</head>

<frameset cols="40%,60%">
 <frame src="../html/div_tag/" title="sample frame" />
 <frame src="../html/span_tag/" title="sample frame" />
</frameset>
<noframes></noframes>

</html>
Test It XHTML Style

Content Model The <frame> element cannot contain any tags.

<frame> Tag Attribute Summary
Required Tag Specific Core Focus Events Language
  frameborder longdesc marginheight marginwidth name1 noresize scrolling src id class style title      
Notes: 1. deprecated in XHTML.

<frame> Tag Attributes
Attribute Description
frameborderThe frameborder attribute specifies whether or not separators should be drawn between this frame and the frames that surround it. Possible values are "1" or "0":
"1" = separators should be drawn.
"0" = separators should not be drawn.
The default value is "1".

HTML <frame> tag example using the frameborder attribute.
<frameset cols="20%,30%,50%">
 <frame src="text.html" frameborder="0">
 <frame src="text.html" frameborder="0">
 <frame src="text.html" frameborder="1">
</frameset>
<noframes></noframes>
Test It HTML Style

XHTML <frame> tag example using the frameborder attribute.
<frameset cols="20%,30%,50%">
 <frame src="text.html" frameborder="0" />
 <frame src="text.html" frameborder="0" />
 <frame src="text.html" frameborder="1" />
</frameset>
<noframes></noframes>
Test It XHTML Style

longdescThe longdesc attribute is used to specify the URL of a long description for the frame.

HTML <frame> tag example using the longdesc attribute.
<frame src="../html/span_tag.html" longdesc="../html/frame_info.html">

XHTML <frame> tag example using the longdesc attribute.
<frame src="../html/span_tag.html" longdesc="../html/frame_info.html" />
marginheightThe marginheight attribute is used to specify the size of the margin, in pixels, between the frame content and the top and bottom of the frame.

HTML <frame> tag example using the marginheight attribute.
<frameset cols="50%,50%">
 <frame src="text.html" marginheight="5">
 <frame src="text.html" marginheight="100">
</frameset>
<noframes></noframes>
Test It HTML Style

XHTML <frame> tag example using the marginheight attribute.
<frameset cols="50%,50%">
 <frame src="text.html" marginheight="5" />
 <frame src="text.html" marginheight="100" />
</frameset>
<noframes></noframes>
Test It XHTML Style

marginwidthThe marginwidth attribute is used to specify the size of the margin, in pixels, between the frame content and the left and right sides of the frame.

HTML <frame> tag example using the marginwidth attribute.
<frameset rows="50%,50%">
 <frame src="text.html" marginwidth="5">
 <frame src="text.html" marginwidth="100">
</frameset>
<noframes></noframes>
Test It HTML Style

XHTML <frame> tag example using the marginwidth attribute.
<frameset rows="50%,50%">
 <frame src="text.html" marginwidth="5" />
 <frame src="text.html" marginwidth="100" />
</frameset>
<noframes></noframes>
Test It XHTML Style

nameThe name attribute is used to assign a name to the frame. The frame can be specified as the target for links by using its name.

The name attribute has been deprecated in XHTML but not HTML. For XHTML, the id attribute can be used instead. To increase forward and backward compatibility, both the name and id attributes can be set to the same value.

HTML <frame> tag example using the name attribute.
<frameset cols="50%,50%">
 <frame src="frame_name.html">
 <frame src="text.html" name="two" id="two">
</frameset>
<noframes></noframes>
Test It HTML Style

XHTML <frame> tag example using the name attribute.
<frameset cols="50%,50%">
 <frame src="frame_name.html" />
 <frame src="text.html" name="two" id="two" />
</frameset>
<noframes></noframes>
Test It XHTML Style


Note: deprecated in XHTML.
noresizeThe noresize attribute can be used to prevent the frame from being resized by the user.

HTML <frame> tag example using the noresize attribute.
<frameset rows="33%,33%,*">
 <frame src="text.html" noresize="noresize">
 <frame src="text.html">
 <frame src="text.html">
</frameset>
<noframes></noframes>
Test It HTML Style

XHTML <frame> tag example using the noresize attribute.
<frameset rows="33%,33%,*">
 <frame src="text.html" noresize="noresize" />
 <frame src="text.html" />
 <frame src="text.html" />
</frameset>
<noframes></noframes>
Test It XHTML Style

scrollingThe scrolling attribute is used to specify whether or not scrolling mechanisms (typically scroll bars) are provided for the frame. Possible values are "auto", "no", or "yes":
"auto" = scrolling mechanisms provided when necessary.
"no" = do not provide scrolling mechanisms.
"yes" = provide scrolling mechanisms.
The default value is "auto".

HTML <frame> tag example using the scrolling attribute.
<frameset rows="50%,50%">
 <frame src="text.html" scrolling="yes">
 <frame src="../html/div_tag/" scrolling="no">
</frameset>
<noframes></noframes>
Test It HTML Style

XHTML <frame> tag example using the scrolling attribute.
<frameset rows="50%,50%">
 <frame src="text.html" scrolling="yes" />
 <frame src="../html/div_tag/" scrolling="no" />
</frameset>
<noframes></noframes>
Test It XHTML Style

srcThe src attribute specifies the URL of the web page that will be displayed in the frame.

HTML <frame> tag example using the src attribute.
<html>

<head>
 <title>HTML Test</title>
</head>

<frameset cols="40%,60%">
 <frame src="../html/div_tag/" title="sample frame">
 <frame src="../html/span_tag/" title="sample frame">
</frameset>
<noframes></noframes>

</html>
Test It HTML Style

XHTML <frame> tag example using the src attribute.
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
 <title>HTML Test</title>
</head>

<frameset cols="40%,60%">
 <frame src="../html/div_tag/" title="sample frame" />
 <frame src="../html/span_tag/" title="sample frame" />
</frameset>
<noframes></noframes>

</html>
Test It XHTML Style

idThe id attribute assigns a unique name to a tag. This allows style sheets or scripts to reference the tag. See id Example
classThe class attribute assigns a class name to a tag. The class name does not need to be unique. More than one tag can have the same class name. This allows style sheets or scripts to reference multiple tags with a single class name. See class Example
styleThe style attribute specifies styles for the tag. For Cascading Style Sheets (CSS), the syntax is name:value. Each name:value pair is separated by semicolons. See style Example
titleThe title attribute specifies additional information about the tag. It is common for browsers to display the title when the pointing device stops over the object. See title Example

HTML <frame> Tag Examples
Test It HTML StyleTest It HTML Style<frame> tag example using the src attribute.
Test It HTML StyleTest It HTML Style<frame> tag example using the frameborder attribute.
Test It HTML StyleTest It HTML Style<frame> tag example using the marginheight attribute.
Test It HTML StyleTest It HTML Style<frame> tag example using the marginwidth attribute.
Test It HTML StyleTest It HTML Style<frame> tag example using the name attribute.
Test It HTML StyleTest It HTML Style<frame> tag example using the noresize attribute.
Test It HTML StyleTest It HTML Style<frame> tag example using the scrolling attribute.