HTML and CSS Reference
In-Depth Information
thetag
<frameset rows=”160,*”>
createstworowsofframes.Theirstrowhasaheight
of160pixels,andtheheightofthesecondrowisequaltowhateverspaceremainsinthe
browserwindow.Youcanalsocombinethethreemethodswithinasingleframeset.Thetag
<frameset cols=”160,25%,*”>
laysouttheframesinthecolumnsshowninFigureE-4.
Theirstcolumnis160pixelswide,thesecondcolumnis25%ofthewidthofthedisplay
area,andthethirdcolumncoverswhateverspaceisleft.
Figure e-4
sizing frames
160 pixels wide
25% of the widt
h
of the display area
whatever space
is left
<frameset cols="160,25%,*">
Itisagoodideatospecifyatleastoneoftherowsorcolumnsofyourframeset
withanasterisktoensurethattheframesillupthescreenregardlessofthesizeofthe
browserwindow.Youcanalsousemultipleasterisks,whichcausebrowserstoallocate
theremainingdisplayspaceequallyamongtheframeswithnodeinedsize.Forexam-
ple,thetag
<frameset rows=”*,*,*”>
createsthreerowsofframesofequalheight.
Aframesetplacesframesineitherrowsorcolumns,butnotboth.So,ifyouwant
tocreatealayoutcontainingframesinrowsandcolumns,youmustnestoneframeset
withinaframeinanotherframeset.Whenyouusethistechnique,theinterpretationof
therowsandcolsattributeschangesslightly.Forthenestedframeset,arowheightof
25%doesnotmean25%ofthebrowserwindowbutrather25%oftheheightofthe
frameinwhichthatframesethasbeenplaced.
Specifying a Frame Source
Framesaremarkedusingtheone-sided<frame/>tag.Withintheframeelement,youuse
the
src
attributetodeinewhichdocumentthatframeshoulddisplay.Thesyntaxis
<frameƒsrc=”
url
”ƒ/>
where
url
istheURLofthedocument.Thefollowingcodecreatesthreerowsofframes
displayingthedocuments
home.htm
,
main.htm
,and
footer.htm
:
<framesetƒrows=”100,ƒ*,ƒ100”>
ƒƒƒ<frameƒsrc=”home.htm”ƒ/>
ƒƒƒ<frameƒsrc=”main.htm”ƒ/>
ƒƒƒ<frameƒsrc=”footer.htm”ƒ/>
</frameset>
Notethat
frame
elementscanbeplacedonlywithinaframeset.