HTML Frames
HTML Frames
mlf
rames
HTMLFr amesar
eusedtodiv i
dethewebbrowserwindowinto
mul
tipl
esecti
onswhereeachsectioncanbel
oadedseparatel
y.
Afr
amesettagisthecol
lect
ionofframesint
hebrowserwindow.
CreatingFrames:I nsteadofusi ngbodyt ag, usefr
amesett agin
HTMLt ousef ramesi nwebbr owser.Butt hisTagisdepr ecat
ed
i
nHTML5.Thef ramesett agisusedt odef inehowt odividethe
browser .Eachframei sindicatedbyf ramet agandi tbasical
ly
defi
neswhi chHTMLdocumentshal l openi ntotheframe.To
defi
net hehor i
zontal f
ramesuser owat tr
ibuteofframet agin
HTMLdocumentandt odefinethever ti
calframesusecol
attr
ibuteoff r
amet aginHTMLdocument .
Exampl e:
<!
DOCTYPEht
ml>
<ht
ml>
<head>
<t
it
le>Exampl
eofHTMLFr
amesusi
ngr
ow
at
tri
bute</t
itl
e>
</
head>
<f
ramesetr
ows="
20%,
60%,
20%"
>
<fr
amename="top"src
="
C:/User
s/dhar
am/
Desktop/at
tr1.
png"/
>
<f
ramename="
mai
n"sr
c=
"
C:/
User
s/dhar
am/
Deskt
op/
gradi
ent
3.png"/
>
<f
ramename="
bot
tom"sr
c=
"
C:/
User
s/dhar
am/
Deskt
op/
col
_l
ast
.png"/
>
<nof
rames>
<body
>Thebr
owsery
ouar
ewor
kingdoes
notsuppor
tfr
ames.
</body
>
</
nof
rames>
</
frameset
>
</
html
>
Output
:Theaboveexamplebasical
l
yusedt ocreatet
hree
hori
zont
alfr
ames:top,mi
ddleandbottom usi
ngr owattr
ibut
eof
fr
amesettagandthenofr
amet agisusedforthosebrowserwho
doesn’
tsuppor
tnoframe.
Exampl
e:Thi
sexampl
eil
l
ust
rat
est
hecol
att
ri
but
eoff
rameset
tag.
<!
DOCTYPEht
ml>
<ht
ml>
<head>
<ti
tl
e>Exampl
eofHTMLFr
amesUsi
ngcol
At
tri
but
e</ti
tl
e>
</
head>
<f
ramesetcol
s="
30%,
40%,
30%"
>
<f
ramename="
top"sr
c=
"
C:/
User
s/dhar
am/
Deskt
op/
att
r1.
png"/
>
<f
ramename="
mai
n"sr
c=
"
C:/
User
s/dhar
am/
Deskt
op/
gradi
ent
3.png"/
>
<f
ramename="
bot
tom"sr
c=
"
C:/
User
s/dhar
am/
Deskt
op/
col
_l
ast
.png"/
>
<nof
rames>
<body
>Thebr
owsery
ouar
ewor
kingdoes
notsuppor
tfr
ames.
</body
>
</
nof
rames>
</
frameset
>
</
html
>
Output
:Theaboveexamplebasi
cal
lyusedtocreat
ethr
eevert
ical
fr
ames:lef
t,cent
erandr
ightusi
ngcolatt
ri
but
eoff r
amesett
ag.
Att
ributesofFr amesettag:
cols:Thecol sattr
ibuteisusedt ocreat
ev ert
icalfr
amesinweb
browser .Thisattr
ibut
ei sbasical
lyusedtodef inethenoof
columnsandi tssizeinsidetheframesettag.
Thesi zeorwi dthofthecol umnissetinthef ramesetint
he
foll
owi ngway s:
U seabsolutev al
ueinpixel
Example:
<fr
amesetcol s=" 300,400,300">
Useper
centagevalue
Exampl
e:
<fr
amesetcols="30%,40%,
30%"
>
Usewil
dcardval
ues:
Exampl
e:
<fr
amesetcol
s="30%,*
,30%"
>
I
ntheaboveexampl
e*wil
ltaket
heremai
ning
per
cent
ageforcr
eat
ingv
ert
icalf
rame.
rows:Therowsat tr
ibutei
susedt ocr
eatehorizont
alf
ramesi
n
webbr owser.Thisatt
ri
buteisusedtodefi
nenoofr owsandit
s
sizei
nsidetheframesettag.
Thesizeofrowsorhei ghtofeachrowuset hefoll
owi
ngways:
Useabsol
utev
aluei
npi
xel
Exampl
e:
<f
ramesetr
ows="
300,
400,
300"
>
Useper
cent
agev
alue
Exampl
e:
<fr
amesetr
ows="30%,
40%,
30%"
>
Usewil
dcardv
alues
Exampl
e:
<fr
amesetr
ows=" 30%,
*,30%"
>
I
ntheaboveexampl
e*will
taketheremai
ning
per
cent
ageforcr
eat
inghor
izont
alfr
ame.
border:Thi
satt
ribut
eofframesettagdefi
nesthewi
dthof
borderofeachframesinpixel
s.Zeroval
ueisusedf
orno
border.
Exampl e:
<f
ramesetbor der
="4"frameset>
framebor der:Thi
sat t
ribut eofframesett agi susedto
speci f
ywhet herthethree- di
mensi onal bordershoul
dbe
displayedbet weenthef ramesornotf orthisusetwov al
ues
0and1, wher e0definesf ornobor derandv alue1signif
ies
fory estherewillbebor der.
framespaci ng:Thisattri
but eofframesett agisusedto
speci f
ytheamountofspaci ngbet weent heframesina
frameset .Thiscantakeanyi nt
egerv alueasanpar ameter
whi chbasicall
ydenot est hevaluei npixel.
Exampl e:
<framespaci ng="20">
I
tmeanst
her
ewi
llbe20pi
xelspaci
ngbet
weent
hef
rames
At
tri
but
esofFrameTag:
name:Thisatt
ri
buteisusedtogi
venamestothe
f
rame.Itdif
fer
enti
ateoneframefr
om anot
her
.It
i
sal sousedtoindicatewhichf
rameadocument
shouldloadedi
nto.
Example:
<framename=" top"src=
"C:
/Users/dhar
am/ Deskt
op/at
tr1.
png"/
>
<fr
amename=" mai
n"sr
c=
"
C:/User
s/dhar
am/Deskt
op/
gradi
ent
3.png"/
>
<fr
amename=" bott
om"src=
"
C:/User
s/dhar
am/ Deskt
op/
col
_l
ast
.png"/
>
Hereweuset
hreef
rameswi
thnamesasl
eftcent
er
andri
ght
.
src:Thisatt
ri
but einframetagisbasical
l
yusedto
definethesourcef i
lethatshoul
dbeloadedint
o
thef r
ame.Thev alueofsrccanbeanyur l
.
Exampl e:
<f
ramename=" l
ef t"src="/html/
lef
t.
htm"/>
Intheaboveexampl
enameofframei
sleftand
sourcefi
lewi
llbel
oadedf
rom “
/ht
ml/
lef
t.
htm”in
frame.
mar gi
nwidth:Thisattr
ibut
einfr
amet agisusedto
specif
ywi dthofthespacesinpixelsbetweent
he
borderandcont ent
sofl ef
tandrightfr
ame.
Example:
<fr
amemar ginwidth="20"
>
marginhei
ght:Thi
sat tr
ibut
einf
rametagisused
tospecif
yheightofthespacesinpi
xel
sbetween
theborderandcontentsoftopandbott
om fr
ame.
Example:
<fr
amemar gi
nheight="20"
>
scr
oll
bar
:Tocont
rolt
heappearanceofscr
ollbar
i
nframeusescr
oll
barat
tri
but
einf r
ametag.This
i
sbasi call
yusedt ocontrolt
heappearanceof
scrol
lbar.Thev al
ueoft hi
sattr
ibut
ecanbey es,
no,auto.Wher ethev al
uenodenotestherewil
lbe
noappear anceofscr ol
lbar.
Exampl e:
<fr
amescr ol
lbar="no">
Advantages:
Ital l
owst heusert ov i
ewmul tipledocument s
wi thinasi ngleWebpage.
Itloadpagesf r
om differentser ver
sinasi ngle
frameset .
T heol derbr owser sthatdonotsuppor tframes
canbeaddr essedusi ngt hetag.
Disadvantages:Duet osomeofi tsdisadv antageitisrar
ely
usedinwebbr owser .
F ramescanmaket hepr oductionofwebsi t
e
compl i
cat ed.
Au seri sunabl etobookmar kanyoft heWeb
pagesv iewedwi thinaf rame.
T hebr owser ’
sbackbut tonmi ghtnotwor kasthe
userhopes.
T heuseoft oomanyf r
amescanputahi gh
wor kloadont heserver.
Ma nyol dwebbr owserdoesn’ tsuppor tfr
ames.
Note:Thist agi snotsuppor t
edi nHTML5.
SupportedBr owser :Thebr owsersuppor tedby<f r
ame>t ag
areli
stedbel ow:
G oogl eChr ome
Inter netExpl orer
F i
ref ox
Op era
S afar i