// References / HTML Frame Tag

Posted The: 02/09/2008 - AT: 17:02

Edited The: 01/10/2008 - AT: 3:57

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

Warning

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

Attributes

Standard Attributes.

Attribute:Value:Description:DTD:
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.

Examples

Simple example.

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

Final Example

The full example

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
   "http://www.w3.org/TR/html4/frameset.dtd">

  <head>
    <title>My first Frameset</title>
  </head>

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

</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" "http://www.w3.org/TR/html4/frameset.dtd">
<html>
 <head>
   <title>Usage of the target attribute with Frames</title>
 </head>
 <frameset cols="15%,*">
   <frame name="MenuFrame" src="Menu.html">
   <frame name="ContentFrame" src="Content.html">
 </frameset>
</html>

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

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

Layouts

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.

Stumble It!

Author: BlueBoden

Comments: [0]

  1. HTML Tutorial
  2. CSS Tutorial
  3. XHTML Tutorial
  4. RSS Tutorial
  5. PHP Tutorial
  6. htaccess Tutorial
  7. Server Tutorial
  8. SEO Tutorial

Checked At:05:12

7 Guests

0 Users

Online doing the past 15 Minutes!

PageRanking.dk - Flere hits og højere PageRank - GRATIS tilmelding!

This page was created in 0.0785708427429 seconds

Welcome Guest