Create a Free Website

HTML Code Tutorial


Frames

Before You Proceed!

The frameset and frame tags are not supported in HTML5.

There is a good chance that if you build your website with frames future browsers won't be able to display it properly.

If you are building your website for serious purposes, I recommend you COW to the wishes of the experts and build your site using conventional methods.

Frames can add a little bit of extra character to any web site.

They are a little harder to set up for search engines, but that doesn't seem to lessen their popularity for many.

The first rule to follow when using frames is to replace the body tag with the
<frameset></frameset> tag.

Frames can be set up in either a row or column configuration.

Create a FREE Website


NO CODING!!

Create beautiful, professional websites
WITHOUT Learning to Code!!

19 Million+ Amazing FLASH websites
created by people just like you,
with no knowledge of HTML coding.

Create Free Websites


Start Your FREE Website Now!



The first frameset tag determines which set up is chosen.

Figures 1 and 2 (below) are diagrams of a row configuration.
The first and defining frameset tag for each would be:
<frameset rows="20/ ,60/, 20/">
</frameset>

The three numbers represent 3 individual frames (rows) within the frameset.

They are percentages of available (vertical) space and should add up to 100. (/ = %)

You can also use absolute height settings specified in pixels and wilcards as shown below.
<frameset rows="150,300,*">

Each individual frame within the frameset must now be defined by either a <frame> or <frameset> tag. If the frame is a single column it is defined with a frame tag. If it contains multiple columns it is defined by a second frameset tag.

For figure 2 the code would be:
<frameset rows="20/,60/,20/">
<frame src="">
<frameset cols="30/,70/">
<frame src="">
<frame src="">
</frameset>
<frame src="">
</frameset>

Notice that the second row in figure 2 contains 2 columns. Each column in that nested frameset must be defined with a frame tag.
The src or source attribute is used to name the html page that will be located within the appropriate frame.
Example:
src="index.html"

Figures 3 and 4 (below) are diagrams of a column configuration.
The first and defining frameset tag for each would be:
<frameset cols="20/ ,80/"></frameset>
The two numbers are percentages of available (horizontal) space and should add up to 100. (/ = %) and represent two individual frames (columns) within the overall frameset.

Each individual frame within the frameset must now be defined by either a <frame> or <frameset> tag. If the frame is a single row it is defined with a frame tag. If it contains multiple rows it is defined by a second frameset tag.

For figure 4 the code would be:
<frameset cols="20/,80/">
<frame src="">
<frameset rows="30/,70/">
<frame src="">
<frame src="">
</frameset>
</frameset>

Notice that the second column in figure 4 contains 2 rows. Each row in that nested frameset must be defined with a frame tag.
The src or source attribute is used to name the html page that will be located within the appropriate frame.
Example:
src="index.html"

Copy and paste this code into an html page and run it through your browser. Be sure to delete the body tags.
Next lesson --> Target and Scrolling

Valid Attributes

If you want your frames pages to validate with the w3c you should only use these atrributes with the frameset and frame tags.

frameset
cols
rows

frame
name
src
frameborder (0/1)
marginwidth
marginheight
noresize
scrolling (yes/no/auto)

Framespacing

The framespacing attribute for the frameset tag has been deprecated. THEY say it never was a compliant attribute, but some of us beg to differ.

If you remove the frameborders from your frame windows using frameborder="0", you will be left with gaps between the sections of your frames page.

You can add the attribute framespacing="0" to each of your frameset tags and the gaps will go away.

Problem is, your pages won't be W3C compliant and won't validate.

The choice is yours. Do you want W3C compliant pages that will validate or better looking designs?
We leave that choice to you!



Check out our Free Frames Template Kit or try our Free Frames Kit Demo