By using this site you agree to the use of cookies by Brugbart and our partners.

Learn more

HTML Frame Tag

Used to load another page inside a frame on a page.

Edited: 2014-12-28 07:14

The frame element in HTML is used together with framesets, to insert a page inside another page.


Using frames is considered a bad practice, since they might pose usability issiues, as well as being difficult to index by search engines.


Standard Attributes.

AttrsOther AttributesId, class, style, titleF
longdescURIlink to long description. F
nameCharacter data.Name of frame for targetting. F
srcURISource of frame content. F
frameborder1|0Frame borders? F
marginwidthPixelsThe margin width in Pixels. F
marginheightPixelsThe margin height in Pixels. F
noresizenoresizeAllow resizeing? F
scrollingyes|no|autoScroll bars? F

DTD. Defines which document type the attribute is allowed. S=Strict, T=Transitional, F=Frameset.


Simple example.

<frame src="First-Page.html">

Final Example

The full example

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"

    <title>My first Frameset</title>

  <frameset cols="25%,75%">
    <frame src="First-Page.html">
    <frame src="Second-Page.html">


The src attribute is required, and the frame element doesn't need to be closed.

Links Target

To make your links open in the correct frame, you should name each frame using the name attribute, and set the target attribute of your links to the frames name attribute.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "">
   <title>Usage of the target attribute with Frames</title>
 <frameset cols="15%,*">
   <frame name="MenuFrame" src="Menu.html">
   <frame name="ContentFrame" src="Content.html">

The links which would open in the "ContentFrame" would then appear as follows:

<a href="About.html" target="ContentFrame">About Page</a>


Extra examples dealing with Frames.

  1. Ad friendly 3column layout in Frames

Because frames are so rarely used, layout examples will be included here, or posted as comments.