HTML and CSS Reference
In-Depth Information
Formatting Frames
Youcancontrolseveralattributesofyourframes:theappearanceofscrollbars,thesize
ofthemarginbetweenthesourcedocumentandtheframeborder,andwhetherornot
usersareallowedtochangetheframesize.Bydefault,ascrollbarisdisplayedwhenthe
contentofthesourcepagedoesnotitwithinaframe.Youcanoverridethissettingusing
the
scrolling
attribute.Thesyntaxforthisattributeis
scrolling=”
type
”
where
type
canbeeither
yes
(toalwaysdisplayascrollbar)or
no
(toneverdisplaya
scrollbar).Ifyoudon'tspecifyasettingforthe
scrolling
attribute,thebrowserdisplays
ascrollbarwhennecessary.Whenworkingwithframes,keepinmindthatyoushould
removescrollbarsfromaframeonlywhenyouareconvincedthattheentireWebpage
willbevisibleintheframe.Todothis,youshouldviewyourWebpageusingseveraldif-
ferentmonitorsettings.FewthingsaremoreirritatingtoWebsitevisitorsthantodiscover
thatsomecontentismissingfromaframeandnoscrollbarsareavailabletorevealthe
missingcontent.
Whenauser'sbrowserretrievesaframe'sWebpage,itdeterminestheamountof
spacebetweenthecontentofthepageandtheframeborder.Occasionally,thebrowser
setsthemarginbetweentheborderandthecontenttoolarge.Generally,youwantthe
margintobebigenoughtokeepthesource'stextorimagesfromrunningintotheframe's
borders.However,youdonotwantthemargintotakeuptoomuchspacebecauseyou
typicallywanttodisplayasmuchofthesourceaspossible.Theattributesforspecifying
marginsizesforaframeare
marginheight=”
value
”ƒmarginwidth=”
value
”
where
marginheight
speciiestheamountofspace,inpixels,aboveandbelowtheframe
source,and
marginwidth
speciiestheamountofspacetotheleftandrightoftheframe
source.Youdonothavetospecifyboththemarginheightandthemarginwidth.However,
ifyouspecifyonlyone,thebrowserassumesthatyouwanttousethesamevalueforboth.
Settingmarginvaluesisaprocessoftrialanderrorasyoudeterminewhatcombinationof
marginsizeslooksbest.Bydefault,userscanresizeframebordersinabrowserbysimply
draggingaframeborder.However,someWebdesignersprefertofreeze,orlock,framesso
thatuserscannotresizethem.Theattributeforpreventingframeresizingis
noresize=”noresize”
Working with Frames and Links
Clickingalinkwithinaframeopensthelinkedileinsidethesameframe;however,you
canspecifyadifferentlocationbyassigninganametoeachframeandthenpointingthe
linktooneoftheothernamedframes.Toassignanametoaframe,addthe
name
attri-
butetothe
frame
element.Thesyntaxforthisattributeis
<frameƒsrc=”
url
”ƒname=”
name
”ƒ/>
where
name
isthenameassignedtotheframe.Caseisimportantinassigningnames:
informationisconsideredadifferentnamethanINFORMATION.Also,framenamescan-
notincludespaces.Topointthelinktoaspeciicframe,addthefollowingattributetothe
linktag:
target=”
name
”
where
name
isthenameyou'veassignedtoaframeinyourWebpage.Forexample,you
cannameaframe
main
usingthefollowingcode:
<frameƒsrc=”home.htm”ƒname=”main”ƒ/>