W3Schools.com

HTML <frame> Tag

Example

A simple three-framed page:

<frameset cols="25%,50%,25%">
  <frame src="frame_a.htm" />
  <frame src="frame_b.htm" />
  <frame src="frame_c.htm" />
</frameset>

Try it yourself »
(more examples at the bottom of this page)

Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The <frame> tag is supported in all major browsers.


Definition and Usage

The <frame> tag defines one particular window (frame) within a <frameset>.

Each <frame> in a <frameset> can have different attributes, such as border, scrolling, the ability to resize, etc.


Tips and Notes

Note: If you want to validate a page containing frames, be sure the <!DOCTYPE> is set to either "HTML Frameset DTD" or "XHTML Frameset DTD".


Differences Between HTML and XHTML

In HTML, the <frame> tag has no end tag. In XHTML, the <frame> tag must be properly closed.

In XHTML, the name attribute of the <frame> tag is deprecated, and will be removed. Use the id attribute instead.


Optional Attributes

DTD indicates in which HTML 4.01/XHTML 1.0 DTD the attribute is allowed. S=Strict, T=Transitional, and F=Frameset.

Attribute Value Description DTD
frameborder 0
1
Specifies whether or not to display a border around a frame F
longdesc URL Specifies a page that contains a long description of the content of a frame F
marginheight pixels Specifies the top and bottom margins of a frame F
marginwidth pixels Specifies the left and right margins of a frame F
name name Specifies the name of a frame F
noresize noresize Specifies that a frame is not resizable F
scrolling yes
no
auto
Specifies whether or not to display scrollbars in a frame F
src URL Specifies the URL of the document to show in a frame F


Standard Attributes

The <frame> tag supports the following standard attributes:

Attribute Value Description DTD
class classname Specifies a classname for an element F
id id Specifies a unique id for an element F
style style_definition Specifies an inline style for an element F
title text Specifies extra information about an element F

More information about Standard Attributes.


Event Attributes

According to the W3C, the <frame> tag does not support any event attributes.

However, the onload event is supported in all browsers.

More information about Event Attributes.


Examples

Try it Yourself - Examples

Horizontal frameset
How to make a horizontal frameset with three different documents.

Mixed frameset
How to make a frameset with three documents, and how to mix them in rows and columns.

Frameset with noresize="noresize"
How to use the "noresize" attribute. The border between frame A and B is not resizable.


WEB HOSTING
Best Web Hosting
PHP MySQL Hosting
Best Hosting Coupons
UK Reseller Hosting
Cloud Hosting
Top Web Hosting
$7.95/mo SEO Hosting
Premium Website Design
WEB BUILDING
XML Editor - Free Trial!
FREE Website BUILDER
Free Website Templates Free CSS Templates
Make Your Own Website
W3SCHOOLS EXAMS
Get Certified in:
HTML, CSS, JavaScript, XML, PHP, and ASP
W3SCHOOLS BOOKS
New Books:
HTML, CSS
JavaScript, and Ajax
STATISTICS
Browser Statistics
Browser OS
Browser Display
SHARE THIS PAGE