HTML and CSS Reference
In-Depth Information
Creating Inline Frames
Anotherwayofusingframesistocreatealoatingframe.IntroducedbyInternet
Explorer3.0andaddedtotheHTML4.0speciications,a
floating frame
,or
inline frame
,
isdisplayedasaseparateboxorwindowwithinaWebpageinmuchthesamewayas
inlineimagesareplacedwithinapage.Thesyntaxforcreatinganinlineframeis
<iframeƒsrc=”
url
”>
ƒƒƒalternate content
</iframe>
where
url
istheURLofthedocumentyouwantdisplayedintheinlineframe,and
alternate content
isthecontentyouwantdisplayedbybrowsersthatdon'tsupport
inlineframes.Thefollowingcodedisplaysthecontentofthe
bio.htm
ilewithinaninline
frame;forbrowsersthatdon'tsupportinlineframes,itdisplaysaparagraphcontaininga
linktotheile:
<iframeƒsrc=”bio.htm”>
ƒƒƒ<p>
ƒƒƒViewƒtheƒonlineƒ<aƒhref=”bio.htm”>bio</a>ƒofƒJeffƒBester
ƒƒƒ</p>
</iframe>
FigureE-6showsanexampleofhowsuchaninlineframemightberenderedbya
Webbrowser.
Figure e-6
example of an inline frame
inline frame
Frame-basedWebsiteshavedrawbacksthathaveledmanyWebsitestodiscontinue
theiruse.AbrowserthatopensaframedsitehastoloadmultipleHTMLilesbeforethe
usercanviewanyofthem,resultinginincreasedwaitingtimeforpotentialcustomers.It
isalsoverydificulttobookmarkpageswithinaframe-basedWebsiteortomaketheir
contentavailabletoInternetsearchenginesthatcreatecontent-basedcatalogs.(Inother
words,ifyouwantyourcontenttobeeasilyfound,don'tuseframes.)Somebrowsers
alsohavedificultyprintingthepageswithinindividualframes,althoughthisislessof
aproblemthanitoncewas.Finally,someuserssimplypreferlayoutswheretheentire
browserwindowisdevotedtoasinglepage.Forthesereasons,manyWebdesignerssug-
gestthatifyoustillwanttouseframes,youshouldcreatebothframedandnonframed
versionsforaWebsiteandgiveuserstheoptionofwhichonetouse.