How to Do Everything with HTML & XHTML

Frames are another example of simple HTML that can become very complex. Complicated framesets with nested frames can be quite confusing to set up. However, a basic frameset is easy to do. The following table lists the necessary elements and attributes:

To Do This

Use This

Add an XHTML frameset <!DOCTYPE> declaration

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "DTD/xhtml1-frameset.dtd">

Create a frameset

<frameset> </frameset>

Create a frame

<frame />

Specify a frame’s source file

<frame src="/books/4/238/1/html/2/page1.htm" />

Assign a name to your frame

<frame name="frame1" />

Provide content for noncompatible browsers

<noframes> </noframes>

Specify rows

<frameset rows="#"> (Pixels or percentages)

Specify columns

<frameset cols="#"> (Pixels or percentages)

Turn borders off

<frame frameborder="no" /> (Default is "yes")

Prevent resizing

<frame noresize />

Add or remove scroll bar

<frame scrolling="auto | yes | no" /> (Default is "auto")

Control margins

<frame marginheight="#" marginwidth="#" /> (# = pixels)

Create a two column frameset

<frameset cols="#, #"> <frame src="/books/4/238/1/html/2/webpage1.htm" /> <frame src="/books/4/238/1/html/2/webpage2.htm" /></frameset>

Create a two row frameset

<frameset rows="#, #"> <frame src="/books/4/238/1/html/2/webpage1.htm" /> <frame src="/books/4/238/1/html/2/webpage2.htm" /></frameset>

Create a nested frameset

<frameset cols="#, #"> <frame src="/books/4/238/1/html/2/webpage1.htm" /> <frame src="/books/4/238/1/html/2/webpage2.htm" /> <frameset rows="#, #"> <frame src="/books/4/238/1/html/2/webpage3.htm /> <frame src="/books/4/238/1/html/2/webpage4.htm /> </frameset></frameset>

Категории