0% found this document useful (0 votes)
3 views

CSS TVET

Uploaded by

ffeyamerga
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

CSS TVET

Uploaded by

ffeyamerga
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 80

Chapt

er1

I
ntr
oduc
tiont
oCSSandBas
icDes
ignPr
inc
ipl
es
CSSi
sas
tyl
esheetl
anguageus
edt
ocont
rolt
hepr
esent
ati
onandl
ayoutofHTMLor
XML doc
ument
s.I
tal
lowsf
ort
he s
epar
ati
on ofc
ont
entand des
ign,enabl
ing
c
ons
ist
entandvi
sual
lyappeal
ingwebpages
.Bas
icdes
ignpr
inc
ipl
esenc
ompas
s
s
tyl
ingel
ement
s,l
ayouts
truc
tur
ing,andmai
ntai
ningac
ohes
ivevi
sualaes
thet
ic.
Thi
sfoundat
ionalknowl
edge i
ses
sent
ialf
orc
reat
ing wel
l-des
igned and us
er-
f
ri
endl
ywebs
ites
.

 Advant
agesandar
easofappl
icat
ionofCSS

CSS (
Cas
cadi
ng St
yle Sheet
s)of
fer
s advant
ages s
uch as enhanc
ed webs
ite
c
ons
ist
enc
y,eas
iermai
ntenanc
e,andi
mpr
ovedpagel
oadi
ngs
peed.I
tpr
ovi
desa
s
epar
ati
onofc
ont
entanddes
ign,maki
ngs
tyl
ingef
fi
ci
ent
.CSSi
swi
del
yappl
iedi
n
webdevel
opmentf
orc
reat
ingr
espons
ivel
ayout
s,c
ust
omi
zi
ngvi
sualel
ement
s,and
ens
uri
ngas
eaml
essus
erexper
ienc
eac
ros
svar
iousdevi
ces
.It
sver
sat
il
it
yand
adapt
abi
li
tymakei
tac
orner
stonet
echnol
ogyf
ormoder
nwebdes
ign.

1.
2.USERREQUI
REMENTSFORCSSSTYLE
Us
err
equi
rement
sar
ethes
pec
ifi
cneedsandwant
sofaus
ert
hatmus
tbet
akeni
nto
ac
countdur
ingt
hewebdes
ignqual
it
yas
sur
anc
epr
oces
s.Theus
err
equi
rement
s
gat
her
ingpr
oces
sinc
ludess
urveys
,int
ervi
ews
,foc
usgr
oups
,andmor
e.Onc
eyou
det
ermi
neus
err
equi
rement
sands
etanac
cept
anc
ecr
iter
iac
hec
kli
stf
oreac
h,you
s
houl
dputt
hem i
nawebs
iter
equi
rement
sdoc
ument
.Thos
ewi
llhel
pyouwi
tht
he
UXdes
ignpr
oces
sbys
pec
ifyi
ngwhatt
hevi
si
tors
houl
dseeont
hewebs
ite,howi
t
s
houl
dwor
k,andanys
pec
ialc
ons
ider
ati
onst
hatneedt
obet
akeni
ntoac
count
.

 Ac
ces
sibi
li
tygui
del
inesf
orUXdes
ignpr
oces
s

Webs
iteac
ces
sibi
li
tygui
del
inesWCAGar
eas
etofbes
tpr
act
icest
hathel
ppeopl
e
wi
thdi
sabi
li
ti
esus
ethei
nter
net
.Thes
egui
del
ineshel
pwebdes
igner
stomake
webs
iteseas
iert
ous
e,byens
uri
ngt
heyar
eac
ces
sibl
etoever
yone.
Thos
egui
del
ines

1
ar
esor
tedi
ntot
hef
oll
owi
ngc
ategor
ies
:

 Oper
abl
e

Youneedt
omakes
uret
hatever
ytas
kisper
for
mabl
eonbot
hkeyboar
dandmous
e,
t
hatus
ershaveenought
imet
ocompl
eteat
ask.

 Per
cei
vabl
e

Youneedt
oens
uret
hatal
lus
ersc
aneas
ilyper
cei
veyourc
ont
ent
.Pr
ovi
det
ext
al
ter
nat
ivesf
orvi
deosandi
mages
,pl
anoni
mpl
ement
ingaudi
oal
ter
nat
ivesf
or
t
ext
ualc
ont
ent
,andens
urei
tcanbec
ons
umedbyvi
si
tor
swhous
esc
reenr
eader
s.

 Under
standabl
e

Maxi
miz
ingt
hec
hanc
est
hatvi
si
tor
swi
llbeabl
etomakes
ens
eofyourc
ont
enti
s
vi
tali
nwebdes
ign.Youc
andoi
tbyavoi
dingc
ompl
exwor
dsandi
nst
ruc
tions
,
expl
aini
nger
rormes
sagesandi
nter
act
ivewebs
itedes
ignel
ement
sindet
ail
..

 Robus
t

Thr
oughqual
it
yas
sur
anc
e,youneedt
oens
uret
hatyourwebs
itei
sac
ces
sibl
efr
om
al
lthedi
ff
erentbr
ows
ersanddevi
cespeopl
eus
etoexpl
oret
hei
nter
net

1.
3.DEVELOPMENTOFCSSTOMATCHUSERREQUI
REMENTS

Bef
oreyous
tar
twr
iti
ngus
err
equi
rement
sforawebs
itedes
ignyouneedt
odeepl
y
under
standyourt
argetaudi
enc
e.

 Bui
ldt
rus
twi
thc
ust
omer
s

Aspeopl
emos
tlybuypr
oduc
tsands
ervi
cesf
rom bus
ines
sest
heyt
rus
t,t
hee-
Commer
cedevel
opmentpr
oces
sneedst
obef
ocus
edonbui
ldi
ngawebs
itet
hat
i
nvokest
rus
twor
thi
nes
s.

Fi
rsti
mpr
ess
ionsar
elas
tingi
mpr
ess
ions
,andt
her
ear
esever
alwaysi
nwhi
chweb
s
trat
egi
stsc
ans
ecur
epos
iti
veones
:

2
 Mi
rrort
hewor
dsofyourt
argetaudi
enc
e

I
mit
ati
ngt
het
oneofyourt
argetaudi
enc
ecanenor
mous
lyi
ncr
eas
eawebs
ite’
s
c
onver
sionr
ates
.

 Evokeemot
ionswi
thvi
sual
s

Power
fulwayt
oconnec
twi
tht
het
argetaudi
enc
eisbyi
ncl
udi
ngphot
osandvi
deos
t
hatevoket
rus
tac
ros
syourl
andi
ngpages
.

 Us
efulandc
reat
ivec
ont
ent

Mos
tus
erswi
llc
omet
oyourwebs
itewi
thonegoal–t
ofi
ndus
efuli
nfor
mat
ion.To
i
mpr
ovec
ust
omerr
etent
ionf
oryourbus
ines
s,youneedt
oens
uret
hatonl
yhi
gh-
qual
it
ycont
entendsuponyourwebs
ite.

 Makei
teas
ytonavi
gat
e

Bef
ores
tar
tingaus
erexper
ienc
edes
ignpr
oces
s,i
tisc
ruc
ialt
oputyour
sel
fint
he
webs
itevi
si
tor
’ss
hoes
.

Youneedt
oens
uret
hatt
henavi
gat
ionmenui
ssi
mpl
etounder
standandpl
aced
exac
tlywher
eus
ersexpec
titt
obe.

 Hor
izont
alnavi
gat
ionbar

Pr
obabl
ythemos
tpopul
arnavi
gat
ionmenut
ype,
thati
sus
ual
lyl
ocat
edatt
het
opof
t
hepage,j
ustbel
ow t
heheader
.Thehor
izont
alnavi
gat
ionbargoesi
nthel
eft
-to-
r
ightdi
rec
tion.

 Ver
tic
als
idebarnavi
gat
ionmenu

Thi
stypeofmenuappear
sont
her
ightorl
efts
ideandus
ual
lys
tret
chesf
romt
het
op
t
othebot
tomoft
hepage

 Dr
opdownnavi
gat
ionmenu

Adr
opdownnavi
gat
ionmenui
sac
ommonus
eri
nter
fac
eel
ementus
edi
n

3
webs
itesand appl
icat
ionst
oor
gani
zeand di
spl
ayal
istofopt
ionsi
na
hi
erar
chi
calmanner
.

 Hambur
gernavi
gat
ionmenu

Thi
sisat
ypeofnavi
gat
ionmenut
hatappear
swhenyouhoveryourmous
eorc
lic
k
overa“
hambur
ger
”but
ton.I
tist
hemos
tpopul
armenut
ypef
ormobi
lewebs
ite
des
ignbec
aus
eitoc
cupi
est
hel
eas
tspac
eunt
ilt
heus
erc
lic
ksoni
t.

 Foot
ernavi
gat
ionmenu

Oneoft
hewebs
itedes
ignel
ement
sthatyous
houl
dn’
tover
lookwhenc
reat
inga
webdevel
opmentc
hec
kli
sti
sthef
oot
ernavi
gat
ionmenu.Asi
tsnames
ugges
ts,i
t
appear
satt
hebot
tomofyourwebpages
.

Uni
tTwoWebpagec
reat
ionsus
ingCSSandHTML

2.
1.STYLEELEMENTSOFAWEBPAGE
 CSSSynt
ax

ACSSc
ompr
isesofs
tyl
erul
est
hatar
eint
erpr
etedbyt
hebr
ows
erandt
henappl
ied
t
othec
orr
espondi
ngel
ement
sinyourdoc
ument
.As
tyl
erul
eismadeoft
hreepar
ts

Thes
elec
torpoi
ntst
otheHTMLel
ementyouwantt
ost
yle.Exampl
e:<
h1>or
<
tabl
e>et
c.

The dec
lar
ati
on bl
ockc
ont
ainsone ormor
e dec
lar
ati
onss
epar
ated by
s
emi
col
ons
.

4
Eac
hdec
lar
ati
oni
ncl
udesaCSSpr
oper
tynameandaval
ue,s
epar
atedbya
c
olon.

Pr
oper
ty−Apr
oper
tyi
sat
ypeofat
tri
but
eofHTMLt
ag.
Puts
impl
y,al
l
t
heHTMLat
tri
but
esar
econver
tedi
ntoCSSpr
oper
ties
.Theyc
oul
dbe
c
olor
,bor
deret
c.

Val
ue−Val
uesar
eas
signedt
opr
oper
ties
.Forexampl
e,c
olorpr
oper
ty
c
anhaveval
ueei
therr
edor#F1F1F1et
c.

Fi
g:2.
1.SomeCSSs
tyl
es

 TheTypeSel
ect
ors

 TheUni
ver
salSel
ect
ors

I
sus
edt
osel
ectandappl
yst
ylest
oal
lel
ement
sonawebpage.

*{c
olor
:#000000;}

 TheDes
cendantSel
ect
ors

Suppos
eyouwantt
oappl
yas
tyl
erul
etoapar
tic
ularel
ementonl
ywheni
tli
es
i
nsi
deapar
tic
ularel
ement
.

ulem{
col
or:#000000;
}
 TheCl
assSel
ect
ors

5
Youc
andef
ines
tyl
erul
esbas
edont
hec
las
sat
tri
but
eoft
heel
ement
s.Al
lthe
el
ement
shavi
ngt
hatc
las
swi
llbef
ormat
tedac
cor
dingt
othedef
inedr
ule.

.
blac
k{c
olor
:#000000;}
 TheI
DSel
ect
ors

Youc
andef
ines
tyl
erul
esbas
edont
hei
dat
tri
but
eoft
heel
ement
s.Al
ltheel
ement
s
havi
ngt
hati
dwi
llbef
ormat
tedac
cor
dingt
othedef
inedr
ule.

#bl
ack{
col
or:#000000;}
h1#bl
ack{c
olor
:#000000;}
 TheChi
ldSel
ect
ors
(>)

Youhaves
eent
hedes
cendants
elec
tor
s.Ther
eisonemor
etypeofs
elec
tor
,whi
chi
s
ver
ysi
mil
art
odes
cendant
sbuthavedi
ff
erentf
unc
tional
it
y.Cons
idert
hef
oll
owi
ng
exampl
e−

body>p{
col
or:#000000;}
 Adj
acentSi
bli
ngSel
ect
or(
+)

Theadj
acents
ibl
ings
elec
tori
sus
edt
osel
ectanel
ementt
hati
sdi
rec
tlyaf
ter
anot
hers
pec
ifi
cel
ement
.

 Gener
alSi
bli
ngSel
ect
or(
~)

Thegener
als
ibl
ings
elec
tors
elec
tsal
lel
ement
sthatar
enexts
ibl
ingsofas
pec
ifi
ed
el
ement
.

 TheAt
tri
but
eSel
ect
ors

Youc
anal
soappl
yst
ylest
oHTMLel
ement
swi
thpar
tic
ularat
tri
but
es.

i
nput
[type="
text
"]{
col
or:#000000;}
 Gr
oupi
ngSel
ect
ors

6
Thegr
oupi
ngs
elec
tors
elec
tsal
ltheHTMLel
ement
swi
tht
hes
ames
tyl
edef
ini
ti
ons
.

 Mul
ti
pleSt
yleRul
es

Youmayneedt
odef
inemul
ti
ples
tyl
erul
esf
oras
ingl
eel
ement
.Youc
andef
ine
t
hes
erul
est
ocombi
nemul
ti
plepr
oper
tiesandc
orr
espondi
ngval
uesi
ntoas
ingl
e
bl
ockasdef
inedi
nthef
gexampl
e:

h1{
col
or:#36C;f
ont
-wei
ght
:nor
mal
;text
-tr
ans
for
m:l
ower
cas
e;}

 AddCSSt
oaWebpage

Ther
ear
efourwayst
oas
soc
iat
est
yleswi
thyourHTMLdoc
ument
.Mos
tcommonl
y
us
edmet
hodsar
einl
ineCSSandExt
ernalCSS.

A)EmbeddedCSS-The<
styl
e>El
ement
Youc
anputyourCSSr
ulesi
ntoanHTMLdoc
umentus
ingt
he<
styl
e>el
ement
.Thi
s
t
agi
spl
acedi
nsi
det
he<
head>
..
.<
/head>t
ags
.

<
html
>
<
head>
<
styl
etype="
text
/cs
s"medi
a="
all
">
body{bac
kgr
ound-
col
or:l
inen;
}
<
/st
yle>
<
/head>
<
body>
<
/body>
<
/ht
ml>

B)I
nli
neCSS-Thes
tyl
eAt
tri
but
e
Youc
anus
est
yleat
tri
but
eofanyHTMLel
ementt
odef
ines
tyl
erul
es.Thes
erul
es
wi
llbeappl
iedt
othatel
ementonl
y.

<
elements
tyl
e="
..
.s
tyl
erul
es.
.
..
">
<
html
>

7
<
head>
<
/head>
<
body>
<
h1s
tyl
e="
col
or:
#36C;
">
Thi
sisi
nli
neCSS
<
/h1>
<
/body>
<
/ht
ml>

C)Ext
ernalCSS-The<
li
nk>El
ement
Anext
ernals
tyl
esheeti
sas
epar
atet
extf
il
ewi
th.
cssext
ens
ion.Youdef
ineal
lthe
St
yler
uleswi
thi
nthi
stextf
il
eandt
henyouc
ani
ncl
udet
hisf
il
einanyHTML
doc
umentus
ing<
li
nk>el
ement
.

<
head>
<
li
nkt
ype="
text
/cs
s"hr
ef="
..
."medi
a="
..
."/
>
<
/head>

D)I
mpor
tedCSS-@i
mpor
tRul
e
@i
mpor
tisus
edt
oimpor
tanext
ernals
tyl
esheeti
namanners
imi
lart
othe<
li
nk>
el
ement
.Her
eist
hegener
ics
ynt
axof@i
mpor
trul
e.

<
head>
@i
mpor
t"URL"
;
@i
mpor
tur
l("
URL"
);
<
/head>
 CSSRul
esOver
ridi
ng

Wehavedi
scus
sedf
ourwayst
oinc
ludes
tyl
esheetr
ulesi
nanHTMLdoc
ument
.Her
e
i
sther
ulet
oover
rideanySt
yleSheetRul
e.

Anyi
nli
nes
tyl
esheett
akeshi
ghes
tpr
ior
ity.So,i
twi
llover
rideanyr
uledef
inedi
n
<
styl
e>.
.
.</
styl
e>t
agsorr
ulesdef
inedi
nanyext
ernals
tyl
esheetf
il
e.

8
Anyr
uledef
inedi
n<s
tyl
e>.
.
.</
styl
e>t
agswi
llover
rider
ulesdef
inedi
nanyext
ernal
s
tyl
esheetf
il
e.

Anyr
uledef
inedi
next
ernals
tyl
esheetf
il
etakesl
owes
tpr
ior
ity,andr
ulesdef
ined
i
nthi
sfi
lewi
llbeappl
iedonl
ywhenabovet
wor
ulesar
enotappl
icabl
e.

Fi
g:2.
2.Cas
cadi
ngOr
der(
Prec
edenc
e)

 CSSComment
s

Manyt
imes
,youmayneedt
oputaddi
ti
onalc
omment
sinyours
tyl
esheetbl
ocks
.So,
i
tisver
yeas
ytoc
ommentanypar
tins
tyl
esheet
.Youc
ans
impl
eputyourc
omment
s
i
nsi
de/
*..
.
..
thi
sisac
ommenti
nst
yles
heet
..
..
.
*/.

/
*Thi
sisas
ingl
e-l
inec
omment*/
/
*Thi
sisa
mul
ti
-l
ine
c
omment*/

 CSS–Uni
ts

9
Val
uesanduni
ts,i
nCSS,ar
esi
gni
fi
cantast
heydet
ermi
net
hes
ize,pr
opor
tions
,and
pos
iti
oni
ng

A)Abs
olut
eLengt
hUni
ts

Thes
e uni
tsar
ecat
egor
ized asf
ixed-
lengt
h uni
ts,whi
ch meanst
hatl
engt
hs
s
pec
ifi
edwi
thabs
olut
euni
tsmai
ntai
nanexac
t,unc
hangeds
izeont
hes
creen.

Exampl
e:

Uni
t Des
cri
pti
on Equi
val
entval
ue Ex
ampl
e

px Pi
xel
s 1px=1/
96t
hof1i
n f
ont
-si
ze:15px;

B)Rel
ati
veLengt
hUni
ts

Ar
erel
ati
vet
osomet
hingel
se,per
hapst
hes
izeoft
hepar
entel
ement
'sf
ont
,ort
he
s
izeoft
hevi
ewpor
t.

Tabl
e:2.
1.Rel
ati
veLengt
hUni
ts

Uni
t Des
cri
pti
on Ex
ampl
e

Rem Rel
ati
vet
ofont
-si
zeoft
her
ootel
ement
. f
ont
-si
ze:
2r
em;

Vh I
tisr
elat
ivet
othehei
ghtoft
hevi
ewpor
t.1vh=1% f
ont
-si
ze:
or1/
100oft
hehei
ghtoft
hevi
ewpor
t. 4vh;

Vw I
tisr
elat
ivet
othewi
dthoft
hevi
ewpor
t.1vw=1% wi
dth:4vw;
or1/
100oft
hewi
dthofvi
ewpor
t.

vmi
n I
tisr
elat
ive t
othe s
mal
ler di
mens
ion oft
he wi
dth:
vi
ewpor
t.1vmi
n=1% or1/
100oft
hevi
ewpor
t'
s 4vmi
n;
s
mal
lerdi
mens
ion.

10
 CSS–Col
ors

CSSus
esc
olorval
uest
ospec
ifyac
olor
.Typi
cal
ly,
thes
ear
eus
edt
osetac
olorei
ther
f
ort
hef
oregr
oundofanel
ement(
i.
e.i
tst
ext
)orel
sef
ort
hebac
kgr
oundoft
he
el
ement
.Theyc
anal
sobeus
edt
oaf
fec
tthec
olorofbor
der
sandot
herdec
orat
ive
ef
fec
ts.

 NamedCol
ors

ACSSnamedc
olori
sthenameofac
olor
,suc
hasr
ed,
blue,
blac
k,orl
ight
-gr
een.

 RGBHexadec
imalCol
ors

A hexadec
imali
sa6di
gitr
epr
esent
ati
on ofac
olor
.Thef
irs
ttwodi
git
s(RR)
r
epr
esentar
edval
ue,t
henextt
woar
eagr
eenval
ue(
GG)
,andt
hel
astar
ethebl
ue
val
ue(
BB)
.

Eac
hhexadec
imalc
odewi
llbepr
ecededbyapoundorhas
hsi
gn'
#'.Fol
lowi
ngar
e
t
heexampl
esofhexadec
imalnot
ati
on.

bor
der
:1pxs
oli
d#f
f0099;

 RGBVal
ues

Thi
scol
orval
uei
sspec
ifi
edus
ingt
her
gb()pr
oper
ty.

I
ttakest
hreeval
ues
,oneeac
hforr
ed,
green,
andbl
ue.

Theval
uec
anbeani
ntegerbet
ween0and255oraper
cent
age.

Col
or:
RGB(
20,
50,
255)

 HSLVal
ues

Thi
scol
orval
uei
sspec
ifi
edus
ingt
hehs
l()f
unc
tion.

HSLs
tandsf
orhue,
sat
urat
ionandl
ight
nes
s.

Hue i
srepr
esent
ed i
n degr
ees (
0-360)
,sat
urat
ion and l
ight
nes
s ar
e
r
epr
esent
edasper
cent
ages(
0% -100%)
.

11
Col
or:
hsl
(0,
0%,
50%)

 c
urr
ent
col
orkeywor
d

Thec
urr
ent
col
orkeywor
dtakest
heval
ueoft
hec
olorpr
oper
tyofanel
ement
.Itc
an
bepas
sedt
oanyot
hers
tyl
ingpr
oper
tyus
ingt
hekeywor
dcur
rent
col
or.

di
v{c
olor
:red;bor
der
:5pxs
oli
dcur
rent
col
or;}

 CSS–Bac
kgr
ounds

Thi
ssec
tiont
eac
hesyouhowt
osetbac
kgr
oundsofvar
iousHTMLel
ement
s.Youc
an
s
ett
hef
oll
owi
ngbac
kgr
oundpr
oper
tiesofanel
ement

Thebac
kgr
ound-
col
orpr
oper
tyi
sus
edt
osett
hebac
kgr
oundc
olorofanel
ement
.

Thebac
kgr
ound-
imagepr
oper
tyi
sus
edt
osett
hebac
kgr
oundi
mageofanel
ement
.

Thebac
kgr
ound-
repeatpr
oper
tyi
sus
edt
ocont
rolt
her
epet
iti
onofani
magei
nthe
bac
kgr
ound.

Thebac
kgr
ound-
pos
iti
onpr
oper
tyi
sus
edt
ocont
rolt
hepos
iti
onofani
magei
nthe
bac
kgr
ound.

Thebac
kgr
ound-
att
achmentpr
oper
tyi
sus
edt
ocont
rolt
hes
crol
li
ngofani
magei
n
t
hebac
kgr
ound.

Thebac
kgr
oundpr
oper
tyi
sus
ed asas
hor
thand t
ospec
ifyanumberofot
her
bac
kgr
oundpr
oper
ties
.

 CSS–Font
s

Thef
ont
-fami
lypr
oper
tyi
sus
edt
ochanget
hef
aceofaf
ont
.

Thef
ont
-st
ylepr
oper
tyi
sus
edt
omakeaf
onti
tal
icorobl
ique.

Thef
ont
-var
iantpr
oper
tyi
sus
edt
ocr
eat
eas
mal
l-c
apsef
fec
t.

Thef
ont
-wei
ghtpr
oper
tyi
sus
edt
oinc
reas
eordec
reas
ehow bol
dorl
ightaf
ont
appear
s.

12
Thef
ont
-si
zepr
oper
tyi
sus
edt
oinc
reas
eordec
reas
ethes
izeofaf
ont
.

Thef
ontpr
oper
tyi
sus
edass
hor
thandt
ospec
ifyanumberofot
herf
ontpr
oper
ties
.

 HTMLFor
ms

AnHTMLf
ormi
sus
edt
ocol
lec
tus
eri
nput
.Theus
eri
nputi
smos
tof
tens
entt
oa
s
erverf
orpr
oces
singThe

<
for
m>El
ement

TheHTML<
for
m>el
ementi
sus
edt
ocr
eat
eanHTMLf
ormf
orus
eri
nput
:

<
for
m>

/
*

f
ormel
ement
s

*/

<
/for
m>

The<
for
m>el
ementi
sac
ont
ainerf
ordi
ff
erentt
ypesofi
nputel
ement
s,s
uchas
:text
f
iel
ds,
chec
kboxes
,radi
obut
tons
,submi
tbut
tons
,et
c.

The<
input
>El
ement

TheHTML<
input
>el
ementi
sthemos
tus
edf
ormel
ement
.

An<
input
>el
ementc
anbedi
spl
ayedi
nmanyway
s,dependi
ngont
het
ypeat
tri
but
e.

Exampl
es:

Type Des
cri
pti
on

<
inputt
ype="
text
"> Di
spl
aysas
ingl
e-l
inet
exti
nputf
iel
d

<
inputt
ype="
radi
o"> Di
spl
aysar
adi
obut
ton(
fors
elec
tingoneofmanyc
hoi
ces
)

<
inputt
ype="
chec
kbox"
> Di
spl
aysac
hec
kbox(
fors
elec
tingz
eroormor
eofmanyc
hoi
ces
)

13
<
inputt
ype="
submi
t"> Di
spl
aysas
ubmi
tbut
ton(
fors
ubmi
tti
ngt
hef
orm)

<
inputt
ype="
but
ton"
> Di
spl
aysac
lic
kabl
ebut
ton

 TextFi
elds

The<
inputt
ype="
text
">def
inesas
ingl
e-l
inei
nputf
iel
dfort
exti
nput
.

Exampl
e

Af
ormwi
thi
nputf
iel
dsf
ort
ext
:

<
html
>

<
body>

<
h2>
Texti
nputf
iel
ds<
/h2>

<
for
m>

<
labelf
or="
fname"
>Fi
rstname:
</l
abel
><br
>

<
inputt
ype="
text
"id="
fname"name="
fname"val
ue="
John"
><br
>

<
labelf
or="
lname"
>Las
tname:
</l
abel
><br
>

<
inputt
ype="
text
"id="
lname"name="
lname"val
ue="
Doe"
>

<
/for
m>

<
/body>

<
/ht
ml>

 The<
label
>El
ement

Not
icet
heus
eoft
he<
label
>el
ementi
ntheexampl
eabove.

The<
label
>tagdef
inesal
abelf
ormanyf
ormel
ement
s.

14
The<
label
>el
ementi
sus
efulf
ors
creen-
readerus
ers
,bec
aus
ethes
creen-
reader
wi
llr
eadoutl
oudt
hel
abelwhent
heus
erf
ocus
esont
hei
nputel
ement
.

 Radi
oBut
tons

The<
inputt
ype="
radi
o">def
inesar
adi
obut
ton.

Radi
obut
tonsl
etaus
ers
elec
tONEofal
imi
tednumberofc
hoi
ces
.

Exampl
e

Af
ormwi
thr
adi
obut
tons
:

<
!DOCTYPEht
ml>

<
html
>

<
body>

<
h2>
Radi
oBut
tons
</h2>

<
p>Choos
eyourf
avor
iteWebl
anguage:
</p>

<
for
m>

<
inputt
ype="
radi
o"i
d="
html
"name="
fav_l
anguage"val
ue="
HTML"
>

<
labelf
or="
html
">HTML<
/label
><br
>

<
inputt
ype="
radi
o"i
d="
css
"name="
fav_l
anguage"val
ue="
CSS"
>

<
labelf
or="
css
">CSS<
/label
><br
>

<
inputt
ype="
radi
o"i
d="
javas
cri
pt"name="
fav_l
anguage"val
ue="
JavaSc
ript
">

<
labelf
or="
javas
cri
pt"
>JavaSc
ript
</l
abel
>

<
/for
m>

<
/body>

15
<
/ht
ml>

 Chec
kboxes

The<
inputt
ype="
chec
kbox"
>def
inesac
hec
kbox.

Chec
kboxesl
etaus
ers
elec
tZEROorMOREopt
ionsofal
imi
tednumberof
c
hoi
ces
.

Exampl
e

Af
ormwi
thc
hec
kboxes
:

<
!DOCTYPEht
ml>

<
html
>

<
body>

<
h2>
Chec
kboxes
</h2>

<
p>The<
str
ong>
inputt
ype="
chec
kbox"
</s
trong>def
inesac
hec
kbox:
</p>

<
for
mac
tion="
/ac
tion_page.
php"
>

<
inputt
ype="
chec
kbox"i
d="
vehi
cle1"name="
vehi
cle1"val
ue="
Bike"
>

<
labelf
or="
vehi
cle1"
>Ihaveabi
ke<
/label
><br
>

<
inputt
ype="
chec
kbox"i
d="
vehi
cle2"name="
vehi
cle2"val
ue="
Car
">

<
labelf
or="
vehi
cle2"
>Ihaveac
ar<
/label
><br
>

<
inputt
ype="
chec
kbox"i
d="
vehi
cle3"name="
vehi
cle3"val
ue="
Boat
">

<
labelf
or="
vehi
cle3"
>Ihaveaboat
</l
abel
><br
><br
>

<
inputt
ype="
submi
t"val
ue="
Submi
t">

<
/for
m>

16
<
/body
>

<
/ht
ml>

 Submi
tBut
ton

The<
inputt
ype="
submi
t">def
inesabut
tonf
ors
ubmi
tti
ngt
hef
orm dat
atoa
f
orm-
handl
er.

Thef
orm-
handl
eri
stypi
cal
lyaf
il
eont
hes
erverwi
thas
cri
ptf
orpr
oces
sing
i
nputdat
a.

Thef
orm-
handl
eri
sspec
ifi
edi
nthef
orm'
sac
tionat
tri
but
e.

Exampl
e

Af
ormwi
thas
ubmi
tbut
ton:

<
!DOCTYPEht
ml>

<
html
>

<
body>

<
h2>
HTMLFor
ms<
/h2>

<
for
mac
tion="
/ac
tion_page.
php"
>

<
labelf
or="
fname"
>Fi
rstname:
</l
abel
><br
>

<
inputt
ype="
tex
t"i
d="
fname"name="
fname"val
ue="
John"
><br
>

<
labelf
or="
lname"
>Las
tname:
</l
abel
><br
>

<
inputt
ype="
tex
t"i
d="
lname"name="
lname"val
ue="
Doe"
><br
><br
>

<
inputt
ype="
submi
t"val
ue="
Submi
t">

<
/for
m>

<
p>I
fyouc
lic
kthe"
Submi
t"but
ton,
thef
orm-
dat
awi
llbes
entt
oapagec
all
ed
"
/ac
tion_page.
php"
.</
p>

17
<
/body
>

<
/ht
ml>

 HTMLDi
vEl
ement

The<
div>el
ementi
sus
edasac
ont
ainerf
orot
herHTMLel
ement
s.

The<
div>el
ementi
sbydef
aul
tabl
ockel
ement
,meani
ngt
hati
ttakesal
l
avai
labl
ewi
dth,
andc
omeswi
thl
inebr
eaksbef
oreandaf
ter
.

Exampl
e

A<
div>el
ementt
akesupal
lavai
labl
ewi
dth:

<
!DOCTYPEht
ml>

<
html
>

<
styl
e>

di
v{bac
kgr
ound-
col
or:#FFF4A3;
}

<
/st
yle>

<
body>

<
h1>
HTMLDI
VExampl
e</
h1>

Lor
emI
psum<
div>
Iamadi
v</
div>dol
ors
itamet
.

<
p>The yel
low bac
kgr
ound i
sadded t
o demons
trat
ethe f
oot
pri
ntoft
he DI
V
el
ement
.</
p>

<
/body>

<
/ht
ml>

Ex
ampl
e2

18
<
!DOCTYPEht
ml>

<
html
>

<
styl
e>

di
v{bac
kgr
ound-
col
or:#FFF4A3;
}

<
/st
yle>

<
body>

<
h1>
HTMLDI
VExampl
e</
h1>

<
div>

<
h2>
London<
/h2>

<
p>Londoni
sthec
api
talc
ityofEngl
and.
</p>

<
p>Londonhasover13mi
ll
ioni
nhabi
tant
s.<
/p>

<
/di
v>

<
p>The yel
low bac
kgr
ound i
sadded t
o demons
trat
ethe f
oot
pri
ntoft
he DI
V
el
ement
.</
p>

<
/body>

<
/ht
ml>

 Cent
eral
igna<
div>el
ement

I
fyouhavea<
div>el
ementt
hati
snot100% wi
de,andyouwantt
ocent
er-
al
igni
t,s
ett
heCSSmar
ginpr
oper
tyt
oaut
o.

<
styl
e>
di
v{wi
dth:
300px;mar
gin:
aut
o;}
<
/st
yle>

 Mul
ti
ple<
div>el
ement
s

19
Youc
anhavemany<
div>c
ont
ainer
sont
hes
amepage.

 Al
igni
ng<
div>el
ement
ssi
debys
ide

Whenbui
ldi
ngwebpages
,youof
tenwantt
ohavet
woormor
e<di
v>el
ement
s
s
idebys
ide,
liket
his
:

Ther
ear
edi
ff
erentmet
hodsf
oral
igni
ngel
ement
ssi
debys
ide,al
linc
lude
s
omeCSSs
tyl
ing.
Wewi
lll
ookatt
hemos
tcommonmet
hods
:

Fl
oat
:TheCSSf
loatpr
oper
tyi
sus
edf
orpos
iti
oni
ngandf
ormat
tingc
ont
ent
andal
lowel
ement
sfl
oatnextt
oeac
hot
heri
nst
eadofont
opofeac
hot
her
.

I
nli
ne-
bloc
k:I
fyouc
hanget
he<
div>el
ement
'sdi
spl
aypr
oper
tyf
rom bl
ockt
o
i
nli
ne-
bloc
k,t
he<
div>el
ement
swi
llnol
ongeraddal
inebr
eakbef
oreand
af
ter
,andwi
llbedi
spl
ayeds
idebys
idei
nst
eadofont
opofeac
hot
her
.

Fl
ex:TheCSSFl
exboxLayoutModul
ewasi
ntr
oduc
edt
omakei
teas
iert
o
des
ignf
lexi
bler
espons
ivel
ayouts
truc
tur
ewi
thoutus
ingf
loatorpos
iti
oni
ng.

To make t
he CSS f
lex met
hod wor
k,s
urr
ound t
he<
div>el
ement
s wi
th
anot
her<
div>el
ementandgi
vei
tthes
tat
usasaf
lexc
ont
ainer
.

Gr
id:TheCSSGr
idLay
outModul
eof
fer
sagr
id-
bas
edl
ayouts
yst
em,wi
th
r
owsandc
olumns
,maki
ngi
teas
iert
odes
ignwebpageswi
thouthavi
ngt
ous
e
f
loat
sandpos
iti
oni
ng.

Soundsal
mos
tthes
ameasf
lex,buthast
heabi
li
tyt
odef
inemor
ethanone
r
owandpos
iti
oneac
hrowi
ndi
vidual
ly.

TheCSSgr
idmet
hodr
equi
rest
hatyous
urr
oundt
he<
div>el
ement
swi
th
anot
her<
div>el
ementandgi
vet
hes
tat
usasagr
idc
ont
ainer
,andyoumus
t
s
pec
ifyt
hewi
dthofeac
hcol
umn.

 HTML<
fiel
dset
>and<
legend>
Tag

The<
fiel
dset
>tagi
sus
edt
ogr
oupr
elat
edel
ement
sinaf
orm.

20
The<
fiel
dset
>tagdr
awsaboxar
oundt
her
elat
edel
ement
s.

Exampl
e

Us
eCSSt
ost
yle<
fiel
dset
>and<
legend>
:

<
!DOCTYPEht
ml>

<
html
>

<
head>

<
styl
e>

f
iel
dset{bac
kgr
ound-
col
or:#eeeeee;
}

l
egend{bac
kgr
ound-
col
or:gr
ay;c
olor
:whi
te;paddi
ng:5px10px;
}

i
nput{mar
gin:5px;
}

<
/st
yle>

<
/head>

<
body>

<
h1>
Thef
iel
dsetel
ement+CSS<
/h1>

<
for
mac
tion="
/ac
tion_page.
php"
>

<
fiel
dset
>

<
legend>
Per
sonal
-i
nfo:
</l
egend>

<
labelf
or="
fname"
>Fi
rstname:
</l
abel
>

<
inputt
ype="
text
"id="
fname"name="
fname"
><br
><br
>

<
labelf
or="
lname"
>Las
tname:
</l
abel
>

<
inputt
ype="
text
"id="
lname"name="
lname"
><br
><br
>

<
labelf
or="
emai
l"
>Emai
l:
</l
abel
>

21
<
inputt
ype="
emai
l"i
d="
emai
l"name="
emai
l"
><br
><br
>

<
labelf
or="
bir
thday"
>Bi
rthday:
</l
abel
>

<
inputt
ype="
dat
e"i
d="
bir
thday"name="
bir
thday"
><br
><br
>

<
inputt
ype="
submi
t"val
ue="
Submi
t">

<
/fi
elds
et>

<
/for
m>

<
/body>

<
/ht
ml>

Out
put
:

 CSS–Text

At
extr
efer
stoapi
eceofwr
itt
enorpr
int
edi
nfor
mat
ioni
nthef
orm ofwor
dsor
c
har
act
erst
hatc
anber
eadandunder
stood.
Text
scani
ncl
udec
ont
ents
uchasbooks
,

22
ar
tic
les
,emai
ls,
mes
sages
,webpages
,et
c.

 TextCol
or

Al
ter
ingt
hec
oloroft
het
extc
anaddvi
suali
nter
estoral
ignwi
thas
pec
ifi
cdes
ign
s
cheme.

TheCSSc
olorpr
oper
tyi
sus
edt
osett
hec
oloroft
het
ext
.Thepos
sibl
eval
uesf
ort
his
pr
oper
tyar
easf
oll
ows
:

 TextAl
ignment

Thepos
iti
onorpl
acementoft
extonapagei
scal
ledi
tsal
ignment
.Thet
exti
s
al
ignedbas
edont
hel
eftandr
ightmar
ginsoft
hepage.

 l
eft
:Al
ignedwi
tht
hel
eft
-mar
gin.

 r
ight
:Al
ignedwi
tht
her
ight
-mar
gin.

 c
ent
er:Al
ignedatt
hec
ent
eroft
hepage.

 j
ust
if
y:Al
ignedwi
thbot
hthemar
gins
.

 j
ust
if
y-al
l:Sameasj
ust
if
y,maki
ngt
hel
astl
inej
ust
if
iedaswel
l.

 TextDi
rec
tion

Tex
tdi
rec
tionr
efer
stot
heor
ient
ati
onoft
extc
har
act
erswi
thi
nadoc
umentor
el
ement
.Itdet
ermi
neswhet
hert
exts
houl
dbedi
spl
ayedf
rom l
eftt
ori
ght(
LTR)or
r
ightt
olef
t(RTL)bas
edont
hewr
iti
ngs
yst
emus
ed.

 TextDec
orat
ion

TheCSSt
ext
-dec
orat
ionpr
oper
tyhel
psi
naddi
ngext
radec
orat
iont
othet
ext
,suc
h
as
,addi
ngal
ine(
under
li
ne,
str
iket
hrough,
over
li
ne)andc
olor
,st
yleandt
hic
knes
sto
t
hel
ine.

 t
ext
-dec
orat
ion-
li
ne: Set
s t
he t
ype of dec
orat
ion l
ine (
under
li
ne,
s
tri
ket
hroughorover
li
ne)
.

23
 t
ext
-dec
orat
ion-
col
or:Set
sthec
olort
othet
extdec
orat
ion.

 t
ext
-dec
orat
ion-
styl
e:Set
sthes
tyl
etot
het
extdec
orat
ion(
dot
ted,das
hed,
s
oli
d,wavy,
doubl
e,et
c.)

 t
ext
-dec
orat
ion-
thi
cknes
s:Set
sthet
hic
knes
stot
het
extdec
orat
ion.

 TextEmphas
is

CSSpr
ovi
desapr
oper
tyt
oappl
yemphas
ismar
ksonabl
ockoft
extus
ingt
he
pr
oper
tyt
ext
-emphas
is.Thes
emar
ksar
etypi
cal
lyus
edt
ohi
ghl
ights
pec
ifi
ccont
ent
ort
oindi
cat
epr
onunc
iat
ionors
tres
sinc
ert
ainl
anguages
.

I
tal
lowst
hedes
ignert
oappl
yemphas
ist
oindi
vidualc
har
act
ersorphr
asewi
thi
na
bl
ockoft
ext
.

I
tisas
hor
thandf
ort
ext
-emphas
is-
styl
eandt
ext
-emphas
is-
col
or.

 TextI
ndent
ati
on

I
ndent
ati
oni
sthes
pac
ebet
weent
hemar
ginandt
hef
irs
tli
neoft
ext
.Pr
oper
i
ndent
ati
onenhanc
est
her
eadabi
li
tyandc
lar
ityoft
extonapage.

CSSal
sopr
ovi
desapr
oper
tyt
osett
het
exti
ndent
ati
onandt
hati
stext
-indent
.The
f
oll
owi
ngval
uesc
anbepas
sedt
othi
spr
oper
ty:

 l
engt
h:Anys
pec
ifi
clengt
h{pi
xel
s(px)
,poi
nts(
pt)
,ems(
em)
,et
c}.Def
aul
t
val
uei
s0.

 per
cent
age(
%):Theval
uepas
sedi
sinr
elat
iont
otheper
cent
ageoft
he
wi
dthoft
hepar
entel
ement
.

 eac
h-l
ine:Af
fec
tst
hef
ir
stl
ineofabl
ockoft
extal
ongwi
theac
hli
neaf
tera
f
orc
edl
inebr
eak.

 hangi
ng:I
ndent
ati
oni
sinver
ted,
exc
eptf
ort
hef
irs
tli
ne.

 i
nit
ial
:Set
sthet
ext
-indentt
oit
sdef
aul
tval
ue.

24
 i
nher
it:Al
lowst
oinher
itt
het
ext
-indentval
uef
romi
tspar
entel
ement
.

 TextLet
terSpac
ing

TheCSSpr
oper
tyl
ett
er-
spac
ingi
sus
edt
oadj
ustt
hes
pac
ebet
weent
hel
ett
ersofa
t
ext
.

Fol
lowi
ngar
ethepos
sibl
eval
uest
hatt
hispr
oper
tyc
anhave:

 nor
mal
:Def
aul
tval
ue and r
epr
esent
sthe nor
malamountofs
pac
e
bet
weenl
ett
ers
.

 l
engt
h:Any s
pec
ifi
clengt
h{pi
xel
s(px)
,poi
nts(
pt)
,ems (
em)
,or
per
cent
ages(
%)}
.

 i
nit
ial
:Set
sthel
ett
er-
spac
ingt
oit
sdef
aul
tval
ue.

 i
nher
it:Al
lowst
oinher
itt
hel
ett
er-
spac
ingval
uef
romi
tspar
entel
ement
.

 TextWor
dSpac
ing

CSSpr
ovi
despr
oper
tyt
oadj
ustt
hes
pac
ingbet
weent
hewor
dsi
napi
eceoft
ext
,jus
t
l
ikel
ett
ers
pac
ing.
Thepr
oper
tyt
oadj
ustt
hes
pac
ebet
weenwor
dsi
swor
d-s
pac
ing.

Thi
spr
oper
tyc
ant
akeanyoft
hef
oll
owi
ngval
ues
:

 nor
mal
:Def
aul
tval
ueandr
epr
esent
sthenor
malamountofs
pac
ebet
ween
wor
ds.

 l
engt
h:Anys
pec
ifi
clengt
h{pi
xel
s(px)
,poi
nts(
pt)
,ems(
em)
,orper
cent
ages
(
%)}
.

 i
nit
ial
:Set
sthewor
d-s
pac
ingt
oit
sdef
aul
tval
ue.

 i
nher
it:Al
lowst
oinher
itt
hewor
d-s
pac
ingval
uef
romi
tspar
entel
ement
.

 TextShadow

Thet
ext
-shadow pr
oper
tyi
sus
edt
oaddas
hadow ef
fec
ttot
ext
.Ital
lowsyout
o
s
pec
ifyt
hec
olor
,of
fset
,bl
ur-
radi
us,ands
pread-
radi
usoft
hes
hadow.Fol
lowi
ngi
s

25
t
hes
ynt
axoft
ext
-shadow:

/
*of
fset
-x|
off
set
-y|
blur
-radi
us|
col
or*/

t
ext
-shadow:1px1px2pxbl
ack;

 TextLi
neBr
eak

CSSpr
ovi
despr
oper
tyl
ine-
breakt
hati
sus
efuli
ndet
ermi
ninghowt
obr
eakl
inesi
na
bl
ockoft
ext
.

 TextWor
dBr
eak

TheCSSwor
d-br
eakpr
oper
tyi
nCSSi
sus
edt
ospec
ifyhowwor
dss
houl
dbebr
oken
orwr
appedi
ncas
etheyexc
eedt
heavai
labl
ewi
dthofanel
ement
.

 I
mages

I
magespl
ayani
mpor
tantr
olei
nanywebpage.Thoughi
tisnotr
ecommendedt
o
i
ncl
udeal
otofi
mages
,buti
tiss
til
limpor
tantt
ous
egoodi
mageswher
everr
equi
red.

CSSpl
aysagoodr
olet
ocont
roli
magedi
spl
ay.Youc
ans
ett
hef
oll
owi
ngi
mage
pr
oper
tiesus
ingCSS.

Thebor
derpr
oper
tyi
sus
edt
osett
hewi
dthofani
magebor
der
.

Thehei
ghtpr
oper
tyi
sus
edt
osett
hehei
ghtofani
mage.

Thewi
dthpr
oper
tyi
sus
edt
osett
hewi
dthofani
mage.

The-
moz
-opac
itypr
oper
tyi
sus
edt
osett
heopac
ityofani
mage.

 Li
nks

I
nwebdevel
opment
,a"
li
nk"gener
all
yref
erst
oanHTMLel
ementt
hatal
lowst
he
us
ert
onavi
gat
efr
om onewebpaget
oanot
herort
oanot
herr
esour
ce,s
uchasa
s
tyl
esheet
,ani
mage,oras
cri
pt.TheHTML<
a>(
anc
hor
)el
ementi
sthemos
t
c
ommonwayt
ocr
eat
eli
nks
.

The:
li
nks
igni
fi
esunvi
si
tedhyper
li
nks
.

26
The:
vis
iteds
igni
fi
esvi
si
tedhy
per
li
nks
.

The:
hovers
igni
fi
esanel
ementt
hatc
urr
ent
lyhast
heus
er'
smous
epoi
nterhover
ing
overi
t.

The:
act
ives
igni
fi
esanel
ementonwhi
cht
heus
eri
scur
rent
lyc
lic
king.

Us
ual
ly,
allt
hes
epr
oper
tiesar
ekepti
ntheheaderpar
toft
heHTMLdoc
ument
.

Remembera:
hoverMUSTc
omeaf
tera:
li
nkanda:
vis
itedi
ntheCSSdef
ini
ti
oni
n
or
dert
obeef
fec
tive.
Als
o,a:
act
iveMUSTc
omeaf
tera:
hover

 Tabl
es

At
abl
eisanHTMLel
ementus
edt
odi
spl
aydat
ainas
truc
tur
edf
ormatwi
thr
owsand
c
olumns
.Iti
scr
eat
edus
ingt
he<
tabl
e>t
agi
nHTMLandc
anbes
tyl
edus
ingCSS
pr
oper
ties
.

Fol
lowi
ngi
sas
impl
eHTMLt
abl
ewhi
chhasbeens
tyl
edus
ingCSS:

<
html
>
<
head>
<
styl
e>
t
abl
e{f
ont
-fami
ly:Ar
ial
,Hel
vet
ica,s
ans
-ser
if;
bor
der
-col
laps
e:c
oll
aps
e;wi
dth:
100%;
}
t
d,t
h{bor
der
:1pxs
oli
d#ddd;paddi
ng:8px;
}
t
r:nt
h-c
hil
d(even)
{bac
kgr
ound-
col
or:#f
2f2f
2;}
t
r:hover{
bac
kgr
ound-
col
or:#ddd;
}
t
h{paddi
ng-
top:12px;paddi
ng-
bot
tom:12px
;text
-al
ign:l
eft
;bac
kgr
ound-
col
or:
#40a944;c
olor
:whi
te;
<
/st
yle>
<
/head>
<
body>
<
h1>
CSSSt
yledTabl
e</
h1>
<
tabl
e>

27
<
tr>
<
th>
Name<
/th>
<
th>
Addr
ess
</t
h>
<
th>
Count
ry<
/th>
<
/tr
>
<
tr>
<
td>
NuhaAl
i<
/td>
<
td>
MyHomeBhooj
a</
td>
<
td>
Indi
a</
td>
<
/tr
>
<
tr>
<
td>
Zar
aAl
i<
/td>
<
td>
Student
sRoos
ter
s</
td>
<
td>
Engl
and<
/td>
<
/tr
>
<
/tabl
e>
<
/body>
<
/ht
ml>

 Pr
oper
tiesofaTabl
e

Youc
ans
ett
hef
oll
owi
ngCSSpr
oper
tiesofat
abl
e

Thebor
der
-col
laps
espec
ifi
es whet
her t
he br
ows
er s
houl
d c
ont
rol t
he
appear
anc
eoft
headj
acentbor
der
sthatt
ouc
heac
hot
herorwhet
hereac
hcel
l
s
houl
dmai
ntai
nit
sst
yle.

Thebor
der
-spac
ings
pec
ifi
est
hewi
dtht
hats
houl
dappearbet
weent
abl
ecel
ls.

Thec
apt
ion-
sides
pec
ifi
eswher
ethet
abl
ecapt
ions
houl
dbedi
spl
ayed(
topor
bot
tom)
.

Theempt
y-c
ell
sspec
ifi
eswhet
hert
hebor
ders
houl
dbes
howni
fac
elli
sempt
y.

28
Thet
abl
e-l
ayoutal
lowsbr
ows
erst
ospeedupl
ayoutofat
abl
ebyus
ingt
hef
irs
t
wi
dthpr
oper
tiesi
tcomesac
ros
sfort
her
estofac
olumnr
athert
hanhavi
ngt
o
l
oadt
hewhol
etabl
ebef
orer
ender
ingi
t.

Thewi
dthandhei
ghtpr
oper
tiess
ett
hehei
ghtandwi
dthofat
abl
e.

Thet
ext
-al
ignpr
oper
tys
etst
hehor
izont
alal
ignmentoft
het
extc
ont
entwi
thi
n
t
abl
ecel
ls.

Thebor
derpr
oper
tyc
anbeus
edt
osetbor
dert
otabl
eandi
tsc
ell
s.

Thebac
kgr
ound-
col
orpr
oper
tyc
anbeappl
iedt
othet
abl
eit
sel
f,t
het
abl
ecel
ls,
ort
abl
erows
.

Thef
ont
-si
ze,
font
-fami
ly,
font
-wei
ght
,font
-col
oret
cst
ylet
het
abl
efont
.

Col
laps
eTabl
eBor
derus
ingCSS

Thepr
oper
tybor
der
-col
laps
eens
urest
hatbor
der
sbet
weent
abl
ecel
lsc
oll
aps
eint
o
as
ingl
e bor
der
,cr
eat
ing a c
leaner l
ook.Pr
oper
tybor
der
-col
laps
ecan have
val
uesc
oll
aps
eors
epar
ate(
def
aul
t).

 Bor
der
s

Thebor
derofanHTMLel
ementi
ssi
mpl
yoneormor
eli
nest
hats
urr
oundt
he
c
ont
entandpaddi
ngofanel
ement
.Ever
ybor
derhast
hreeas
pec
ts:i
tswi
dth,or
t
hic
knes
s;i
tss
tyl
e,orappear
anc
e;andi
tsc
olor
.

The CSSbor
derpr
oper
ties al
low you t
ospec
ify how t
he bor
der oft
he box
r
epr
esent
inganel
ements
houl
dlook.
Ther
ear
ethr
eepr
oper
tiesofabor
der

bor
der
-st
yle-Spec
ifi
eswhet
herabor
ders
houl
dbes
oli
d,das
hedl
ine,
doubl
eli
ne,
or
oneoft
heot
herpos
sibl
eval
ues
.

bor
der
-col
or-Spec
ifi
est
hec
olorofabor
der
.Thedef
aul
tval
uei
sthef
oregr
ound
c
oloroft
heel
ementandi
fel
ementi
sbl
ank,
thenc
oloroft
hepar
entel
ement

bor
der
-wi
dth-Spec
ifi
est
hewi
dthofabor
der
.Thedef
aul
tval
uei
smedi
um.

29
Exampl
e:

<
pst
yle="
bor
der
-st
yle:none;
">Nobor
der
.</
p>

<
pst
yle="
bor
der
-st
yle:hi
dden;
">Hi
ddenbor
der
.</
p>

<
pst
yle="
bor
der
-st
yle:dot
ted;
">Dot
tedbor
der
.</
p>

 RoundedBor
der
s

Wec
anus
ebor
der
-radi
uspr
oper
tyt
oaddr
oundedbor
der
stoanel
ement
.

Synt
ax

P{ bor
der
:2pxs
oli
d#40a944;bor
der
-radi
us:5px;
}

 Mar
gins

Themar
ginpr
oper
tyi
sus
edt
osett
hemar
gins
pac
ear
oundanel
ement
.Mar
ginsar
e
t
hes
pac
eout
sidet
hebor
derofanel
ement
.Themar
ginpr
oper
tyc
anbes
etf
or
i
ndi
viduals
ides(
top,r
ight
,bot
tom,l
eft
)orasas
hor
thandpr
oper
tyf
oral
lsi
desat
onc
e.

 Mar
gins-Si
ngl
e-Si
dePr
oper
ties

CSSpr
ovi
desf
ours
epar
atepr
oper
tiest
osetmar
ginsf
orl
eft
,ri
ght
,topandbot
tom
f
oranel
ement
.

mar
gin-
bot
tom,
mar
gin-
top,
mar
gin-
lef
tandmar
gin-
right

Fol
lowi
ngexampl
edemons
trat
eshow wec
an s
etdi
ff
erentmar
ginsar
oundh1
el
ement
s:

h1 {
mar
gin-
top:20px;mar
gin-
right
:40px;mar
gin-
bot
tom:
10px;
mar
gin-
lef
t:0px;
bac
kgr
ound-
col
or:#eee;
}

 Mar
gins-SetThr
eeVal
ues

Wec
ans
etmar
ginatt
hreeval
uesasmar
gin:20px40px10px,
int
hisc
aset
opmar
gin
wi
llbe20px,r
ightandl
eftmar
ginswi
llbe40pxandbot
tom mar
ginwi
llbe10px.

30
Fol
lowi
ngi
stheexampl
e.Yous
houl
dtr
ytoc
ompar
etheout
putwi
thpr
evi
ous
exampl
e:

h1{
mar
gin:20px40px10px;bac
kgr
ound-
col
or:#eee;
}

 Mar
gins-SetTwoVal
ues
:

Wec
ans
etmar
ginatt
woval
uesasmar
gin:20px40px,i
nthi
scas
etopandbot
tom
mar
ginswi
llbe20px,
rightandl
eftmar
ginswi
llbe40px.

h1{
mar
gin:20px40px;bac
kgr
ound-
col
or:#eee;
}

Wehaves
eent
hats
ett
ingas
ingl
eval
uef
ormar
gin,
appl
iesmar
ginequal
lyt
oal
lthe
s
ides-t
op,r
ight
,bot
tom andl
eft
.Youc
anc
hec
kver
yfi
rstexampl
etounder
stand
t
hisc
ase.

 Mar
gins-Mi
xupUni
ts

CSSal
lowst
omi
xupt
het
ypesofl
engt
hval
ueyouus
ewhi
les
pec
ifyi
ngdi
ff
erent
mar
ginsi
nas
hor
thandpr
oper
ty.

 CSSNegat
iveMar
gins

CSSal
lowst
ospec
ifynegat
ivemar
ginsf
oranel
ement
.Thi
swi
llc
aus
etheel
ement
’s
boxt
ost
ickoutofi
tspar
entort
oover
lapot
herel
ement
s.

 Mar
gins-Per
cent
ages

I
tisver
ymuc
hpos
sibl
etos
etper
cent
ageval
uesf
ort
hemar
ginsofanel
ement
.
Per
cent
agemar
ginsval
uesar
ecomput
edi
nrel
ati
ont
othewi
dthoft
hepar
ent
el
ement
’sc
ont
entar
ea,
sot
heyc
anc
hangei
fthepar
entel
ement
’swi
dthc
hanges
.

 Mar
gins-I
nli
neEl
ement
s

Mar
ginsc
anal
sobeappl
iedt
oinl
ineel
ement
sbutt
opandbot
tommar
ginsdo
nothaveanyef
fec
tont
hel
inehei
ghtoft
hes
enonr
epl
acedel
ement
sand
t
hes
emar
ginsar
eal
way
str
ans
par
ent
.

 Mar
gins-Aut
oVal
ue

31
I
nor
dert
ocent
eranel
ementi
nsi
dei
tspar
ent
,us
emar
gin:0aut
oass
howni
nthe
f
oll
owi
ngexampl
e:

<
styl
e>

di
v{wi
dth:
600px;bor
der
:1pxdot
ted;
}

h1{
mar
gin:
0aut
o;}

<
/st
yle>

 Li
sts

Li
stsar
eus
efulast
heypr
esentt
hei
nfor
mat
ioni
nas
truc
tur
edandor
gani
zed
manner
.Li
stsi
mpr
ovet
her
eadabi
li
tyandc
ompr
ehens
ionofc
ont
entonawebpage.
So,
ift
hec
ont
enti
sli
sted,
iti
seas
ytof
oll
ow.

Li
stsar
ecommonl
yus
edt
odi
spl
ayi
tems
,st
eps
,opt
ions
,oranyot
hert
ypeofr
elat
ed
i
nfor
mat
iont
hats
houl
dbepr
esent
eds
equent
ial
lyori
nagr
oup.

 Or
der
edLi
st

Or
der
edl
ist
sar
eus
edwhent
hei
temsneedt
obepr
esent
edi
nas
pec
ifi
cor
der
mar
kedwi
thnumber
sorl
ett
ers
.Fol
lowi
ngi
sthes
ynt
axt
ocr
eat
eHTMLor
der
edl
ist
s:

<
ol>

<
li
>Fi
rst
</l
i>

<
li
>Sec
ond<
/li
>

<
li
>Thi
rd<
/li
>

<
/ol
>

 Unor
der
edLi
st

Unor
der
edl
ist
sar
eus
edwhent
hei
temsneedt
obepr
esent
edi
nas
pec
ifi
cor
der
mar
kedwi
ths
impl
ebul
let
s.

32
 CSSLi
sts-Pr
oper
ties

CSSpr
ovi
desas
etofpr
oper
tiest
hatc
anbeappl
iedt
oanyl
ist
,whi
char
easf
oll
ows
:

Thel
ist
-st
yle-
typeal
lowsyout
ocont
rolt
hes
hapeorappear
anc
eoft
hel
istmar
ker
s
(
bul
letpoi
nts
).

Thel
ist
-st
yle-
pos
iti
onal
lowst
ospec
ifyt
hepos
iti
onoft
hel
ist
-it
emmar
ker
s.

Thel
ist
-st
yle-
images
pec
ifi
esani
magef
ort
hemar
kerr
athert
hanabul
letpoi
ntor
number
.

Thel
ist
-st
yles
ervesass
hor
thandpr
oper
tyf
ort
omanaget
hemar
ker
s.

CSSLi
sts-Mar
kerTypes

CSSal
lowsyout
ocont
rolt
hes
hapeoft
hel
istmar
ker
s(bul
letpoi
nts
).Thef
oll
owi
ng
exampl
eshowshow CSS pr
oper
tyl
ist
-st
yle-
types
etsdi
ff
erentmar
ker
sfort
he
or
der
edandunor
der
edl
ist
s.Thes
amepr
oper
tyc
anbeus
edf
orbot
hor
der
edand
unor
der
edl
ist
s.

Youc
anc
hec
kCSSpr
oper
tyl
ist
-st
yle-
typedet
ailt
ochec
kal
lthepos
sibl
emar
ker
's
t
ypesf
ort
hel
ist
s.

 CSSLi
sts-I
mageMar
ker

You mi
ghtpr
efert
o us
ean i
mageasan i
tem l
istmar
ker
.TheCSSl
ist
-st
yle-
i
magepr
oper
tyc
anbeus
edt
otos
pec
ifyani
mageasani
teml
istmar
ker
.

Youc
anus
eyourownbul
lets
tyl
e.I
fnoi
magei
sfound,t
hendef
aul
tbul
let
sar
e
pr
int
ed.
Fol
lowi
ngi
sanexampl
etos
howt
heus
ageofl
ist
-st
yle-
imagepr
oper
ty.

ul{
li
st-
styl
e-i
mage:ur
l('
/i
mages
/ic
on-
bul
let
.png'
);
}

 CSSLi
sts-Mar
kerPos
iti
on

TheCSSl
ist
-st
yle-
pos
iti
onpr
oper
tyi
ndi
cat
eswhet
hert
hemar
kers
houl
dappear
i
nsi
deorout
sideoft
heboxc
ont
aini
ngt
hebul
letpoi
nts
.Itc
anhaveoneoft
he
f
oll
owi
ngval
ues−

33
none-Nomar
keri
sdi
spl
ayed,andt
hel
isti
temsar
ewi
thoutanybul
letpoi
ntsor
number
s.

I
nsi
de-Themar
keri
spos
iti
onedi
nsi
det
hec
ont
entf
low,meani
ngi
tappear
swi
thi
n
t
hec
ont
entboxoft
hel
isti
tem.

Out
side-Thedef
aul
tval
ue.Themar
keri
spos
iti
onedout
sidet
hec
ont
entf
low,
appear
ingt
othel
eftoft
hec
ont
entboxoft
hel
isti
tem.

I
nher
it-i
sus
edt
oinher
itt
hel
ist
-st
yle-
pos
iti
onval
uef
romi
tspar
entel
ement
.

Fol
lowi
ngi
sanexampl
etos
howt
heus
ageofl
ist
-st
yle-
pos
iti
onpr
oper
ty.

<
styl
e>

ul
.a{
li
st-
styl
e-pos
iti
on:out
side;
}

ul
.b{
li
st-
styl
e-pos
iti
on:i
nsi
de;
}

<
/st
yle>

 Li
sts-Cont
rol
ledCount
ing

Somet
imewemi
ghtwantt
ocountdi
ff
erent
lyonanor
der
edl
ist— e.
g.,s
tar
ting
f
rom anumberot
hert
han1,orc
ount
ingbac
kwar
ds,orc
ount
ingi
nst
epsofmor
e
t
han1.

Ther
e ar
efol
lowi
ng t
hree CSS at
tri
but
es whi
ch hel
ps i
ncont
rol
li
ng t
he l
ist
number
ing.

<
star
t>-al
lowsyout
ost
artt
hel
istc
ount
ingf
romanumberot
hert
han1.

<
rever
sed>-s
tar
tst
hel
istc
ount
ingr
ever
seordowni
nst
eadofup.

Ex
ampl
e:

<
html
>
<
body>
<
h2>
CSSLi
sts-Cont
rol
ledCount
ing<
/h2>

34
<
h3>
star
tat
tri
but
e</
h3>
<
ols
tar
t="
4">
<
li
>Java.
</l
i>
<
li
>HTML.
</l
i>
<
li
>CSS.
</l
i>
<
li
>Reac
t.<
/li
>
<
/ol
>
<
h3>
rever
seat
tri
but
e</
h3>
<
olr
ever
sed>
<
li
>Java.
</l
i>
<
li
>HTML.
</l
i>
<
li
>CSS.
</l
i>
<
li
>Reac
t.<
/li
>
<
/ol
>
<
/body>
<
/ht
ml>

 Li
sts-Col
ors

Wec
anmakel
ist
slookmor
est
yli
shandc
olor
fulus
ingCSSs
tyl
ingasdemons
trat
ed
i
nthef
oll
owi
ngexampl
e.Aswes
eeanys
tyl
ingaddedt
othe<
ul>or<
ol>t
agwi
ll
af
fec
ttheent
irel
ist
,wher
east
headdi
ti
ont
othei
ndi
vidual<
li
>tagwi
llaf
fec
tonl
y
t
hei
temsoft
hec
orr
espondi
ngl
ist
.

Ex
ampl
e:

ull
i{bac
kgr
ound:ol
ive;c
olor
:whi
te;paddi
ng:
10px;f
ont
-si
ze:
20px;mar
gin:
10px
;}

 Paddi
ngs

35
TheCSSpaddi
ngpr
oper
tyi
sus
edt
ospec
ifyt
hes
pac
ebet
weent
hec
ont
entofan
el
ementandi
tsbor
der
s.Thi
sar
tic
lewi
llt
eac
hyouCSSpaddi
ngpr
oper
tyandi
ts
c
ons
tit
uentpr
oper
ties
.

Theval
ueofCSSpaddi
ngs
houl
dbeei
theral
engt
h,aper
cent
age,
ort
hewor
dinher
it.
Apaddi
ngpr
oper
tydoesnotal
lownegat
iveval
ues
.Ift
heval
uei
sinher
it,
itwi
llhave
t
hes
amepaddi
ngasi
tspar
entel
ement
.

Ex
ampl
e:h2{
paddi
ng:5px;bac
kgr
ound-
col
or:#eee;
}

 CSSPaddi
ngs-Si
ngl
e-s
idePr
oper
ties

CSSpr
ovi
desf
ours
epar
atepr
oper
tiest
osetpaddi
ngf
ort
op,r
ight
,bot
tom,andl
eft
f
oranel
ement
.Thes
epr
oper
tiesar
e:

paddi
ng-
top,
paddi
ng-
right
,paddi
ng-
bot
tomandpaddi
ng-
lef
t

Fol
lowi
ngexampl
eshowshowdi
ff
erentpaddi
ngpr
oper
tiesc
anbes
etar
oundanh2
el
ement
.

h2{
paddi
ng-
top:20px;paddi
ng-
right
:40px;
paddi
ng-
bot
tom:
10px;paddi
ng-
lef
t:0px;

bac
kgr
ound-
col
or:#eee;

 Cur
sor

TheCSSc
urs
orpr
oper
tydet
ermi
nest
heappear
anc
eoft
hemous
ecur
sorwhen
hover
ingoveranel
ementt
owhi
cht
hispr
oper
tyi
sappl
ied.Thi
spr
oper
tyi
sonl
y
appl
icabl
einenvi
ronment
swi
thmous
eandc
urs
orf
unc
tional
it
y.I
t'
smai
npur
pos
eis
t
oimpr
oveus
abi
li
tybyvi
sual
lyr
epr
esent
ingc
ert
ainf
unc
tions
.

 Pos
sibl
eCur
sorVal
ues

Thec
urs
orpr
oper
tyc
anhavef
oll
owi
ngval
ues
:

<
url
>:(
opt
ional
)Youhavet
hef
lexi
bil
it
ytous
eas
eri
esofur
l()val
uess
epar
atedby
c
ommas
,wi
theac
hur
l()poi
nti
ngt
oani
magef
il
e.

<
x><
y>:(
opt
ional
)Youhavet
heopt
iont
ospec
ifyxandyc
oor
dinat
est
hatdef
inet
he

36
hot
spotoft
hec
urs
orands
pec
ifyt
heexac
tpos
iti
onwi
thi
nthec
urs
ori
maget
hatt
he
c
urs
orpoi
ntst
o.

<
Keywor
d>:
Akeywor
dval
uei
srequi
redt
hats
pec
ifi
esei
thert
hec
urs
ort
ypet
ous
eor
t
heal
ter
nat
ecur
sort
ous
eifnoneoft
hes
pec
ifi
eds
ymbol
scanbel
oaded.

Keywor
dBas
edCur
sorVal
ues

Thef
oll
owi
ngt
abl
eli
stst
heavai
labl
ekeywor
ds.

Keywor
d Ex
ampl
e Des
cri
pti
on

Aut
o Thedi
spl
ayedc
urs
ori
sdet
ermi
nedbyt
heus
eragent
bas
edont
hec
urr
entc
ont
ext
.Thi
sist
hedef
aul
t
pr
oper
tyt
hatt
hebr
ows
erus
est
odef
inet
hec
urs
or.

Def
aul
t Thedef
aul
tcur
sor
,whi
chvar
iesdependi
ngont
he
pl
atf
orm,
isus
ual
lydi
spl
ayedasanar
row.

Poi
nter Thedi
spl
ayedc
urs
ori
spoi
nterc
urs
or,s
howi
ngt
he
c
urs
ors
ervesasani
ndi
cat
orpoi
nti
ngt
oahyper
li
nk.

 Out
li
nes

CSSdef
inesas
pec
ials
ortofel
ementdec
orat
ionc
all
edanout
li
newhi
chi
sdr
awn
out
sidet
heel
ement
'sbor
der
.CSSout
li
nesar
ever
ysi
mil
art
obor
der
s,butt
her
ear
e
f
ewmaj
ordi
ff
erenc
esaswel
l

Anout
li
nedoesnott
akeups
pac
e.

Out
li
nesdonothavet
ober
ect
angul
ar.

Exampl
e:Fol
lowi
ngi
srec
tangl
ehavi
ngabl
ackbor
derof5pxandgr
eenout
li
neof
30px
.

37
Thi
stut
ori
alwi
llt
eac
hushow t
osetdi
ff
erentpr
oper
tiesas
soc
iat
edwi
thout
li
nes
.
CSSal
owsust
ocont
rolanout
li
newi
dth,
itsc
olor
,st
yleet
c.

 Out
li
neCol
or

Theout
li
ne-
col
orpr
oper
tyi
sus
edt
ospec
ifyt
hec
oloroft
heout
li
ne.
Itsval
ues
houl
d
ei
therbeac
olorname,ahexc
olor
,oranRGBval
ue,aswi
tht
hec
olorandbor
der
-
c
olorpr
oper
ties
.

Name-Exampl
ered,
blueorgr
een

HEX-Exampl
e#f
f0000

RGB-Exampl
ergb(
255,
0,0)

HSL-Exampl
ehs
l(0,
100%,
50%)

Ex
ampl
e:

<
pst
yle="
out
li
ne-
widt
h:t
hic
k;out
li
ne-
styl
e:s
oli
d;out
li
ne-
col
or:
rgb(
255,
200,
0);
paddi
ng:
5px
;">
Out
li
nec
olors
etwi
thRGBc
ode"
rgb(
255,
200,
0)"
.</
p>

 Out
li
neOf
fset

Theout
li
ne-
off
setpr
oper
tyi
sus
edt
ospec
ifyt
hes
pac
ebet
weenanout
li
neandt
he
bor
deredgeofanel
ement
.Thes
pac
ebet
weent
heout
li
neandt
heel
ementi
s
t
rans
par
ent
.

Thef
oll
owi
ngexampl
eshowanout
li
ne20pxout
sidet
hebor
deroft
heel
ement
:

38
Theaboveexampl
eshowst
hatt
hes
pac
ebet
weenanel
ement
'sbor
derandi
ts
out
li
nei
str
ans
par
ent
.

Ex
ampl
e:

<
p s
tyl
e = "
bor
der
:1px s
oli
d #000; out
li
ne:
1px s
oli
d r
ed; out
li
ne-
of
fset
:20px
;mar
gin:
25px"
>Out
li
neof
fset20px;
</p>

 Out
li
nevsBor
der

Thet
woobvi
ousdi
ff
erenc
esar
ethatout
li
nesc
annothaveahi
ddens
tyl
ewher
easa
bor
der
scanbehi
ddens
econdanout
li
nec
anhaveaut
ost
ylewher
easbor
derc
an'
t
havei
t.Fol
lowi
ngt
abl
eil
lus
trat
esmor
edi
ff
erenc
esbet
weenout
li
neandbor
der
:

Tabl
e:2.
2out
li
neandbor
derc
ompar
ison

Out
li
ne Bor
der

Out
li
nei
sanon-
rec
tangul
ars
hape Bor
deri
sa r
ect
angul
ars
hape t
hati
s
t
hats
urr
oundsanel
ement
,us
ual
ly dr
awnar
oundt
hec
ont
entofanel
ement
,
wi
thas
oli
dcol
or. c
anbes
oli
d,das
hed,ordot
ted,andc
an
havedi
ff
erentc
olor
sands
izes
.

I
tdoesnott
akeupanys
pac
eint
he I
taf
fec
tst
he s
ize and pos
iti
on oft
he
l
ayoutanddoesnotaf
fec
tthes
ize el
ement
,asi
taddswi
dtht
otheel
ement
.
orpos
iti
onoft
heel
ement
.

I
tist
ypi
cal
lyus
edt
ohi
ghl
ightor I
tcanbeus
edf
orvar
iouspur
pos
es,s
uch
emphas
ize an el
ement
,suc
h as ass
epar
ati
ng el
ement
s,c
reat
ing boxes
,
when an el
ementi
sfoc
used or andaddi
ngvi
sualemphas
is.
ac
tivat
ed.

39
I
t c
an be c
reat
ed us
ing I
t c
an be c
reat
ed us
ing
t
heout
li
nepr
oper
tyi
nCSS. t
hebor
derpr
oper
tyi
nCSS.

 TheCSSBoxModel
Al
lHTMLelementscanbec
onsi
deredasboxes
.InCSS,
thet
erm"
boxmodel
"isus
ed
whent
alki
ngaboutdesi
gnandl
ayout.
TheCSSboxmodeli
sessent
iall
yaboxthatwr
apsaroundever
yHTMLel
ement
.It
cons
ist
sof:mar
gins
,bor
ders,paddi
ng,
andtheact
ualcont
ent.

Fi
g:2.
2.Boxmodel
 Hei
ght&Wi
dth(
Dimens
ion)

The di
mens
ions of HTML el
ement
s i
s of
ten s
pec
ifi
ed wi
th
CSSwi
dthandhei
ghtpr
oper
ties and we c
an us
ethes
e pr
oper
ties t
osett
he
di
mens
ionoft
heel
ement
s.

CSS al
so pr
ovi
des pr
oper
ties l
ikemax
-wi
dth,
min-
widt
h,max-
hei
ghtandmi
n-
hei
ghtt
osett
hemaxi
mum/
mini
mumwi
dthandhei
ghtofanel
ement
.

Thehei
ghtandwi
dthpr
oper
tiesal
lowyout
osett
hehei
ghtandwi
dthofanel
ement
.
Thes
epr
oper
tiesc
anhol
dfol
lowi
ngval
ues
:

l
engt
h:Thehei
ghtandwi
dthofanel
ementc
anbeofanyuni
tofl
engt
h(px,pt
,
em,
in,
etc
.)

per
cent
age(
%):Theval
uec
anbepas
sedasaper
cent
ageval
ue,whi
chi
sin
per
centoft
hec
ont
aini
ngbl
ock.

40
aut
o:Br
ows
erc
alc
ulat
est
hehei
ghtandwi
dthoft
heel
ement
.Iti
sthedef
aul
t
val
ue.

i
nit
ial
:Set
stheval
ueofhei
ghtandwi
dtht
oit
sdef
aul
tval
ue.

i
nher
it:Theval
ueofhei
ghtandwi
dthi
sinher
itedf
romi
tspar
entval
ue.

Thehei
ghtandwi
dthpr
oper
tiesdonotaddanyt
hingt
othel
ayoutoft
heel
ementi
.e
t
heydonoti
ncl
udepaddi
ng,
mar
ginorbor
der
s.Theys
ett
hehei
ghtandwi
dthoft
he
ar
eai
nsi
det
hepaddi
ng,
bor
der
,andmar
ginoft
heel
ement
.

 Max-
Hei
ght

CSSc
anl
imi
tthemaxi
mum hei
ghtofanel
ementus
ingmax-
hei
ghtpr
oper
ty.Thi
s
pr
oper
tyal
lowst
ospec
ifymaxi
mum hei
ghtofanel
ement
.Theval
ueoft
hemax-
hei
ghtpr
oper
tyc
anbe:

none:Nomaxi
mumhei
ghtval
uei
sset
.Thi
sist
hedef
aul
tval
ue.

l
engt
h:Set
sthemaxi
mumhei
ghti
nter
msofl
engt
huni
ts(
px,
pt,
em,
in,
etc
.)

per
cent
age(
%):Theval
uei
srel
ati
vet
otheper
centofc
ont
aini
ngbl
ock.

i
nit
ial
:Set
stheval
ueofhei
ghtandwi
dtht
oit
sdef
aul
tval
ue.

i
nher
it:Theval
uei
sinher
itedf
romi
tspar
entval
ue.

 mi
n-hei
ght

CSSc
anl
imi
tthemi
nimum hei
ghtofanel
ementus
ingmi
n-hei
ghtpr
oper
ty.Thi
s
pr
oper
tyal
lowst
ospec
ifymi
nimum hei
ghtofanel
ement
.Its
pec
ifi
est
hes
mal
les
t
hei
ghtt
hatanel
ementc
anhave,
ens
uri
ngt
hati
twi
llnevers
hri
nkbel
owt
hatval
ue.
Theval
ueoft
hemi
n-hei
ghtpr
oper
tyc
anbe:

l
engt
h:Set
sthemi
nimumhei
ghti
nter
msofl
engt
huni
ts(
px,
pt,
em,
in,
etc
.)

per
cent
age(
%):Theval
uei
srel
ati
vet
otheper
centofc
ont
aini
ngbl
ock.

i
nit
ial
:Set
stheval
ueofhei
ghtandwi
dtht
oit
sdef
aul
tval
ue.

41
i
nher
it:Theval
uei
sinher
itedf
romi
tspar
entval
ue.

Themi
nimum hei
ghtwi
llbeappl
ied,
whent
hec
ont
enti
ssmal
lert
hant
hemi
nimum
hei
ght
.Andwhent
hec
ont
enti
slar
gert
hant
hemi
nimum hei
ght
,theval
ueofmi
n-
hei
ghthasnoef
fec
tont
heel
ement
.

 max-
widt
h

CSSc
anl
imi
tthemaxi
mum wi
dthofanel
ementus
ingmax-
widt
hpr
oper
ty.Thi
s
pr
oper
tyal
lowst
ospec
ifymaxi
mum wi
dthofanel
ement
.Theval
ueoft
hemax-
wi
dthpr
oper
tyc
anbe:

none:Nomaxi
mumwi
dthval
uei
sset
.Thi
sist
hedef
aul
tval
ue.

l
engt
h:Set
sthemaxi
mumwi
dthi
nter
msofl
engt
huni
ts(
px,
pt,
em,
in,
etc
.)

per
cent
age(
%):Theval
uei
srel
ati
vet
otheper
centofc
ont
aini
ngbl
ock.

i
nit
ial
:Set
stheval
ueofhei
ghtandwi
dtht
oit
sdef
aul
tval
ue.

i
nher
it:Theval
uei
sinher
itedf
romi
tspar
entval
ue.

Themax-
widt
hval
ueover
ridest
heval
ueofwi
dthpr
oper
ty.I
fthec
ont
entwi
thi
nthe
el
ementi
slar
gert
hant
hes
pec
ifi
edmax-
widt
h,i
twi
llaut
omat
ical
lyadj
ustt
he
hei
ghtoft
heel
ementt
oac
commodat
ethec
ont
entwi
thi
ntheel
ement
.Ift
he
c
ont
entwi
thi
ntheel
ementi
ssmal
lert
hant
hes
pec
ifi
edmax-
widt
h,t
hemax-
widt
h
pr
oper
tyhasnoef
fec
t.

 mi
n-wi
dth

CSSc
anl
imi
tthemi
nimum wi
dthofanel
ementus
ingmi
n-wi
dthpr
oper
ty.Thi
s
pr
oper
tyal
lowst
ospec
ifymi
nimum wi
dthofanel
ement
.Its
pec
ifi
est
hes
mal
les
t
wi
dtht
hatanel
ementc
anhave,ens
uri
ngt
hati
twi
llnevers
hri
nkbel
owt
hatval
ue.
Theval
ueoft
hemi
n-wi
dthpr
oper
tyc
anbe:

 l
engt
h:Set
sthemi
nimumwi
dthi
nter
msofl
engt
huni
ts(
px,
pt,
em,
in,
etc
.)

 per
cent
age(
%):Theval
uei
srel
ati
vet
otheper
centofc
ont
aini
ngbl
ock.

42
 i
nit
ial
:Set
stheval
ueofhei
ghtandwi
dtht
oit
sdef
aul
tval
ue.

 i
nher
it:Theval
uei
sinher
itedf
romi
tspar
entval
ue.

I
fthec
ont
entwi
tht
heel
ementi
slar
gert
hant
hemi
n-wi
dth,
themi
n-wi
dthpr
oper
ty
hasnoef
fec
tbuti
fthec
ont
entwi
tht
heel
ementi
ssmal
lert
hant
hes
pec
ifi
edmi
n-
wi
dth,
themi
nimumwi
dthwi
llbeappl
ied.

 Sc
rol
lbar
s

Ther
emaybeac
asewhenanel
ement
'sc
ont
entmi
ghtbel
argert
hant
heamountof
s
pac
eal
loc
atedt
oit
.Forexampl
e,gi
venwi
dthandhei
ghtpr
oper
tiesdonotal
low
enoughr
oomt
oac
commodat
ethec
ont
entoft
heel
ement
.

Tabl
e:2.
3.Sc
rol
1barval
ues

Sr
.No. Val
ue&Des
cri
pti
on

1 Vi
si
ble:
All
owst
hec
ont
entt
oover
flow t
hebor
der
sofi
tsc
ont
aini
ng
el
ement
.

2 Hi
dden:
Thec
ont
entoft
henes
tedel
ementi
ssi
mpl
ycutof
fatt
he
bor
deroft
hec
ont
aini
ngel
ementandnos
crol
lbar
sisvi
si
ble.

3 Sc
rol
l:Thes
izeoft
hec
ont
aini
ngel
ementdoesnotc
hange,butt
he
s
crol
lbar
sar
eaddedt
oal
lowt
heus
ert
osc
rol
ltos
eet
hec
ont
ent
.

 Di
spl
ay

 Di
spl
ay:
Inl
ine

Anel
ementwi
thadi
spl
aypr
oper
tys
ett
oinl
inewi
llnots
tar
tonanewl
ineandi
t
wi
llt
akeupt
her
emai
ning/
avai
labl
esc
reenwi
dth.
Itj
ustt
akesupt
hes
pac
esuc
h
anel
ementwoul
dnor
mal
lyt
ake.
Bec
aus
eoft
his
,youc
an'
tsett
hewi
dthand
hei
ghtofanel
ementt
hathasadi
spl
ayofi
nli
ne,bec
uas
eitdoesnott
akeupt
he
whol
esc
reenwi
dth.

Someel
ement
sar
einl
inebydef
aul
t,l
ike<
span>
,<a>
,<i
>,and<
img>
.

43
 di
spl
ay:bl
ock

Anel
ementt
hathast
hedi
spl
aypr
oper
tys
ett
obl
ocks
tar
tsonanew l
ineand
t
akesupt
heavai
labl
esc
reenwi
dth.

Youc
ans
pec
ifyt
hewi
dthandhei
ghtpr
oper
tiesf
ors
uchel
ement
s.Exampl
esof
el
ement
sthatar
eatbl
ock-
levelbydef
aul
tar
e<di
v>,
<sec
tion>
,<p>
,andl
otsmor
e.

I
nli
nevsbl
ockvsi
nli
ne-
bloc
k

Di
ff
erenc
ebet
weendi
spl
ay:i
nli
ne,
dis
play:bl
ockanddi
spl
ay:i
nli
ne-
bloc
k:

Tabl
e:2.
3.I
nli
neBl
ockandi
nli
ne-
bloc
kcompar
ison

I
nli
ne bl
ock i
nli
ne-
bloc
k

Theel
ementi
sdi
spl
ayed The el
ement i
s Theel
ementi
sdi
spl
ayed
ont
hes
amel
ine. di
spl
ayed on a new ont
hes
amel
ine.
l
ine.

I
tdoesnott
akeupt
hef
ullI
ttakes up t
he f
ullI
tdoesnott
akeupt
hef
ull
wi
dthoft
hec
ont
ainer
. wi
dthoft
hec
ont
ainer
. wi
dthoft
hec
ont
ainer
.

I
tdoesnothaveamar
gin I
thas a mar
gin and I
t has a mar
gin and
orpaddi
ngbydef
aul
t. paddi
ngbydef
aul
t. paddi
ngbydef
aul
t.

Fol
lowi
ngdi
agr
am s
howst
hedi
ff
erentl
ayoutbehavi
orofi
nli
ne,
bloc
k,andi
nli
ne-
bl
ockel
ement
s:

44
 Navi
gat
ionLi
nksUs
ingI
nli
neBl
ock

Thei
nli
ne-
bloc
kpr
oper
tyi
sus
edt
ocr
eat
ehor
izont
alnavi
gat
ionmenusorl
ist
s,
wher
eeac
hnavi
gat
ioni
tem i
sdi
spl
ayedasabl
ock-
levelel
ement
,butr
emai
nsi
nli
ne
wi
thot
heri
tems
.

 I
magesAndTextUs
ingI
nli
neBl
ock

Thei
nli
ne-
bloc
kpr
oper
tyc
aus
est
hei
mageands
pant
obedi
spl
ayedont
hes
ame
l
ine,
all
owi
ngt
hemt
obeal
ignedhor
izont
all
ywi
thi
nthebl
ock.

 Vi
si
bil
it
y

TheCSSvi
si
bil
it
ypr
oper
tyal
lowsyout
oshoworhi
deanel
ementwi
thoutc
hangi
ng
t
hel
ayoutofadoc
ument
,whi
lehi
ddenel
ement
stakeups
pac
e.

Thevi
si
bil
it
ypr
oper
tyc
ant
akeanyoft
hef
oll
owi
ngval
ues
:

Vi
si
ble−Theel
ementi
svi
si
ble.

hi
dden−Theel
ementi
shi
dden,
buti
tst
il
ltakesups
pac
eont
hepage.

c
oll
aps
e−Removet
abl
erows
,col
umns
,col
umngr
oups
,andr
ow gr
oupsf
rom a
t
abl
e.c
oll
aps
ehast
hes
amemeani
ngashi
ddeni
fiti
sus
edonnon-
tabl
eel
ement
s.

i
nit
ial−Set
sthevi
si
bil
it
yofanel
ementt
oit
sdef
aul
tval
ue.

i
nher
it−I
nher
itst
hevi
si
bil
it
ypr
oper
tyf
romi
tspar
entel
ement

 Over
flow

Theover
flowpr
oper
ty det
ermi
nes how c
ont
entwhi
ch over
flows i
ts el
ement
's
c
ont
entar
eas
houl
dbehandl
ed.

Pos
sibl
eVal
ues

vi
si
ble−Over
flowi
ngc
ont
ents
houl
dbedi
spl
ayed.

45
hi
dden−Over
flowi
ngc
ont
ents
houl
dnotbedi
spl
ayed.

s
crol
l−Over
flowi
ngc
ont
ents
houl
dnotbedi
spl
ayed,butt
heus
eragents
houl
d
pr
ovi
des
omemeansofac
ces
singt
hehi
ddenc
ont
ent(
e.g.
,as
etofs
crol
lbar
s).

aut
o−Thebehavi
orc
aus
edbyt
hisval
uei
sdependentont
hebr
ows
er.

 Res
izeEl
ement
s

CSSr
esi
zei
sapr
oper
tyt
hatal
lowsus
erst
oadj
ustt
hes
izeofanel
ement
,ei
ther
ver
tic
all
y,hor
izont
all
y,bot
h,ornone,
bas
edont
hes
pec
ifi
edval
ue.

Res
ize pr
oper
tyaddsahandl
e att
hebot
tom-
rightc
ornerofan el
ementon a
webpage.Thi
shandl
eal
lowsus
erst
ocl
ickanddr
agt
ochanget
hes
izeofan
el
ement
s,maki
ngi
tlar
gerors
mal
lerac
cor
dingt
othei
rpr
efer
enc
e.

none−Nous
er-
cont
rol
labl
emet
hodf
orr
esi
zi
nganel
ementi
spos
sibl
e.Thi
sis
def
aul
tval
ue.

ver
tic
al−Us
erc
anr
esi
zeanel
ementi
nthever
tic
aldi
rec
tion.

hor
izont
al−Us
erc
anr
esi
zeanel
ementi
nthehor
izont
aldi
rec
tion.

bot
h−Us
erc
anr
esi
zeanel
ementbot
hhor
izont
all
yandver
tic
all
y.

bl
ock−Us
erc
anr
esi
zeanel
ementi
nthebl
ockdi
rec
tion(
eit
herhor
izont
all
yor
ver
tic
all
y,dependi
ngont
hewr
iti
ng-
modeanddi
rec
tionval
ue)
.

i
nli
ne−Us
erc
anr
esi
zeanel
ementi
nthei
nli
nedi
rec
tion(
eit
herhor
izont
all
yor
ver
tic
all
y,dependi
ngont
hewr
iti
ng-
modeanddi
rec
tionval
ue)
.

 Quot
es

TheCSSquot
espr
oper
tys
etshowt
hebr
ows
ers
houl
drenderquot
ati
onmar
kst
hat
ar
eaut
omat
ical
lyaddedt
otheHTML<
q>el
ement

46
 Hover

TheCSS:hoverps
eudo-
clas
sisus
edt
otar
getanel
ementwhent
heus
erhover
sover
i
twi
tht
hemous
ecur
sor
.

CSSSynt
ax

:
hover
{…}

 CSSHover-Li
nkCol
orChange

Fol
lowi
ngi
sanexampl
eofc
hangi
ngt
hebac
kgr
oundc
olorofal
inkwhenmous
e
c
urs
orc
omesoveri
t.

 Hover-Bac
kgr
oundCol
orChange

Her
eisanexampl
eofc
hangi
ngt
hebac
kgr
oundc
olorofabut
tonwhenmous
ecur
sor
c
omesoveri
t:

 Hover-ChangeCur
sorShape

Her
eisanexampl
eofc
hangi
ngt
hec
urs
ors
hapewhenmous
ecur
sorc
omesovert
he
but
ton:

 Hover-ChangeBor
derShape

Her
eisanexampl
e,wher
ebor
deroft
hel
inki
schangi
ngonhover
:

 CSS-Opac
ity

The CSSopac
itypr
oper
tyc
ont
rol
sthe t
rans
par
enc
y of an el
ement
.Opac
ity
det
ermi
neshowmuc
hofahi
ddenel
ement
'sc
ont
enti
svi
si
ble.

number−I
trepr
esent
edasadec
imalnumberf
rom0t
o1.

per
cent
age−I
trepr
esent
edasaper
cent
agef
rom0% t
o100%.

Fol
lowi
ngt
abl
eshowi
ngt
hedi
ff
erentopac
ityval
ues
:

Tabl
e:2.
4.Opac
ityval
ue

47
Val
ue Des
cri
pti
on

0 Theel
ementi
sful
lyt
rans
par
entandnotvi
si
ble.

0.
5 Theel
ementi
shal
ftr
ans
par
ent
.

1 Theel
ementi
sful
lyopaqueandvi
si
ble.

 Navi
gat
ionbar

Anavi
gat
ionbari
sas
ect
ionofagr
aphi
calus
eri
nter
fac
e(GUI
)thathel
psus
ers
navi
gat
ethr
oughawebs
ite,
app,
orot
hers
oft
war
e.I
tises
sent
ialf
orus
erst
oqui
ckl
y
andeas
ilynavi
gat
etot
hec
ont
entt
heyar
elooki
ngf
or.

Thenavi
gat
ionbarc
anbehor
izont
alorver
tic
al,t
hatc
ont
ainsl
inkst
oimpor
tant
pagesorf
eat
ures
.Navbar
scanal
soc
ont
ainot
herel
ement
s,s
uchast
hel
ogooft
he
webs
iteorapp,
sear
chbar
,ors
oci
almedi
aic
ons
.Navbar
scanbes
tyl
edus
ingCSSt
o
c
hanget
hei
rappear
anc
e.

 CSSHor
izont
alNavbar

Fol
lowi
ngexampl
eshowsahor
izont
alnavi
gat
ionbar
,whi
chi
sthemos
tcommon
t
ypeofnavi
gat
ionbardi
spl
ayedac
ros
sthet
opofawebpageass
hownbel
ow

<
html
>
<
head>
<
styl
e>
ul{
bac
kgr
ound-
col
or:#28bf
17;
over
flow:hi
dden;
l
ist
-st
yle-
type:none;

48
mar
gin:0;
paddi
ng:0;
}
l
i{
f
loat
:lef
t;
}
l
ia{
di
spl
ay: bl
ock;
col
or: #f
2f2f
2;t
ext
-al
ign: c
ent
er;
paddi
ng: 10px;
text
-dec
orat
ion:
none;
font
-si
ze:17px;
}
l
ia:
hover{
bac
kgr
ound-
col
or:#dd9ede;
col
or:bl
ack;
}
.
act
ive-
li
nk{
bac
kgr
ound-
col
or:#f
53319;
col
or:whi
te;
}
<
/st
yle>
<
/head>
<
body>
<
ul>
<
li
><ahr
ef="
#"c
las
s="
act
ive-
li
nk"
>Tut
ori
als
poi
nt<
/a>
</l
i>
<
li
><ahr
ef="
#">
Home<
/a>
</l
i>
<
li
><ahr
ef="
#">
Art
icl
es<
/a>
</l
i>
<
li
><ahr
ef="
#">
Cour
ses
</a>
</l
i>
<
li
><ahr
ef="
#">
eBook<
/a>
</l
i>
<
/ul
>
<
h1>
Wel
comet
oTut
ori
als
Poi
nt<
/h1>
<
h3>
Simpl
eEas
yLear
ningatyourf
inger
tips
</h3>
<
/body>
<
/ht
ml>
 CSSVer
tic
alNavbar

Aver
tic
alnavi
gat
ionbari
sal
soknownasas
idebarmenu.
Iti
stypi
cal
lypos
iti
onedon
t
hel
eftorr
ights
ideoft
hes
creen.

Ex
ampl
e

49
<
html
>
<
head>
<
styl
e>
ul{
bac
kgr
ound-
col
or:#28bf
17;
li
st-
styl
e-t
ype:none;
mar
gin:0;
paddi
ng:0;
widt
h:
200px;
}
l
i{t
ext
-al
ign:c
ent
er;
}
l
ia{
dis
play:bl
ock;
col
or:#f
2f2f
2;t
ext
-al
ign:c
ent
er;
paddi
ng:10px;
text
-dec
orat
ion:
none;
font
-si
ze:17px;
}
l
ia:
hover{
bac
kgr
ound-
col
or:#dd9ede;
col
or:bl
ack;
}
.
act
ive-
li
nk{
bac
kgr
ound-
col
or:#f
53319;
col
or:whi
te;
}
<
/st
yle>
<
/head>
<
body>
<
ul>
<
li
><ahr
ef="
#"c
las
s="
act
ive-
li
nk"
>Tut
ori
als
poi
nt<
/a>
</l
i>
<
li
><ahr
ef="
#">
Home<
/a>
</l
i>
<
li
><ahr
ef="
#">
Art
icl
es<
/a>
</l
i>
<
li
><ahr
ef="
#">
Cour
ses
</a>
</l
i>
<
li
><ahr
ef="
#">
eBook<
/a>
</l
i>
<
/ul
>
<
/body>
<
/ht
ml>

 CSSDr
opdownNavbar

Adr
opdownnavbari
sanavi
gat
ionbarwi
thadr
op-
downmenut
hatappear
swhena
us
erhover
soveral
ink.
Dropdownmenusar
eawayt
oshowal
istofr
elat
edi
temsi
n
as
mal
lspac
e.

Ex
ampl
e

50
<
html
>
<
head>
<
styl
e>
.
navbar{
bac
kgr
ound-
col
or:#28bf
17;
over
flow:hi
dden;
}
.
navbara{
dis
play:bl
ock;
fl
oat
:lef
t;c
olor
:#f
2f2f
2;t
ext
-al
ign:c
ent
er;
paddi
ng:10px;
t
ext
-dec
orat
ion:none;
font
-si
ze:15px;
}
.
navbara:
hover{
bac
kgr
ound-
col
or:#dd9ede;
col
or:bl
ack;
}
.
act
ive-
li
nk{
bac
kgr
ound-
col
or:#f
53319;
col
or:whi
te;
}
.
dropdown{
float
:lef
t;}
.
dropdown.
dropbt
n{bor
der
:none;
col
or:#f
2f2f
2;paddi
ng:10px;
bac
kgr
ound-
col
or:
#28bf
17;
}
.
dropdown-
cont
ent{
dis
play
:none;
pos
iti
on:abs
olut
e;bac
kgr
ound-
col
or:#c
7385a;
mi
n-wi
dth:120px;
}
.
dropdown-
cont
enta{
float
:none;
col
or:#f
2f2f
2;paddi
ng:10px;
dis
play:bl
ock;
t
ext
-al
ign:l
eft
;}
.
dropdown-
cont
enta:
hover{
bac
kgr
ound-
col
or:#dd9ede;
col
or:bl
ack;
}
.
dropdown:
hover.
dropdown-
cont
ent{
dis
play:bl
ock;
}
<
/st
yle>
<
/head>
<
body>
<
navc
las
s="
navbar
">
<
ahr
ef="
#"c
las
s="
act
ive-
li
nk"
>Tut
ori
als
poi
nt<
/a>
<
ahr
ef="
#">
Home<
/a>
<
divc
las
s="
dropdown"
>
<
but
tonc
las
s="
dropbt
n">
Art
icl
es<
/but
ton>
<
divc
las
s="
dropdown-
cont
ent
">
<
ahr
ef="
#">
HTML<
/a>
<
ahr
ef="
#">
CSS<
/a>
<
ahr
ef="
#">
Boot
str
ap<
/a>
<
/di
v>

51
<
/di
v>
<
ahr
ef="
#">
Cour
ses
</a>
<
ahr
ef="
#">
eBook<
/a>
<
/nav>
<
h1>
Wel
comet
oTut
ori
als
Poi
nt<
/h1>
<
h3>
Simpl
eEas
yLear
ningatyourf
inger
tips
</h3>
<
/body>
<
/ht
ml>

 CSSFi
xedNavbar

Af
ixednavbari
sanavi
gat
ionbart
hats
tic
kst
othet
opoft
hes
creenwhent
heus
er
s
crol
ls down t
he page.To make a navbar f
ixed,you c
an us
ethepos
iti
on:
f
ixedpr
oper
ty.

Fi
xedVer
tic
alNavbar

Thef
oll
owi
ngexampl
edemons
trat
eshowt
hepos
iti
on:f
ixedpr
oper
tyc
anbeus
edt
o
c
reat
eaf
ixedver
tic
alnavbar
,whi
chens
urest
hatt
henavbars
taysont
hel
efts
ideof
t
hes
creen,
evenwhent
heus
ers
crol
lsdownt
hepage.

<
html
>
<
head>
<
styl
e>
ul{
pos
iti
on:f
ixed;
bac
kgr
ound-
col
or:#28bf
17;
li
st-
styl
e-t
ype:none;
mar
gin:0;
paddi
ng:0;
widt
h:200px;
hei
ght
:100%;
}
l
i{t
ext
-al
ign:c
ent
er;
bor
der
-bot
tom:2pxs
oli
d#f
013c
8;}
l
ia{
dis
play:bl
ock;
col
or:
#f2f
2f2;
text
-al
ign:c
ent
er;
paddi
ng:10px;
t
ext
-dec
orat
ion:none;
font
-si
ze:17px;
}
l
ia:
hover{
bac
kgr
ound-
col
or:#dd9ede;
col
or:bl
ack;
}
.
act
ive-
li
nk{
bac
kgr
ound-
col
or:#f
53319;
col
or:whi
te;
}
.
headi
ng{
paddi
ng-
top:170px;
text
-al
ign:c
ent
er;
bac
kgr
ound-
col
or:#e6e451;

52
paddi
ng-
bot
tom:300px}
<
/st
yle>
<
/head>
<
body>
<
ul>
<
li
><ahr
ef="
#"c
las
s="
act
ive-
li
nk"
>Tut
ori
als
poi
nt<
/a>
</l
i>
<
li
><ahr
ef="
#">
Home<
/a>
</l
i>
<
li
><ahr
ef="
#">
Art
icl
es<
/a>
</l
i>
<
li
><ahr
ef="
#">
Cour
ses
</a>
</l
i>
<
li
><ahr
ef="
#">
eBook<
/a>
</l
i>
<
/ul
>
<
divc
las
s="
headi
ng"
>
<
h1>
Wel
comet
oTut
ori
als
Poi
nt<
/h1>
<
h2>
Tut
ori
als
poi
ntCSSFi
xedVer
tic
alNavbar
</h2>
<
h3>
Simpl
eEas
yLear
ningatyourf
inger
tips
</h3>
<
/di
v>
<
/body>
<
/ht
ml>

 I
mageGal
ler
y

CSSi
magegal
ler
yisac
oll
ect
ionofi
magest
hati
sdi
spl
ayedus
ingCSS.CSSc
anbe
us
edt
ocont
rolt
hel
ayoutoft
hei
mages
,thei
rsi
ze,s
pac
ing,andot
hervi
sual
pr
oper
ties
.

CSSi
magegal
ler
iesar
ecommonl
yus
edonwebs
itest
odi
spl
aypr
oduc
ts,por
tfol
ios
,
orot
hervi
sualc
ont
enti
navi
sual
lyappeal
ingway.

Thef
oll
owi
ngexampl
eshowsas
impl
eimagegal
ler
ylayoutt
hati
sdi
spl
ayedi
nar
ow

<
html
>
<
head>

53
<
styl
e>
.
image-
gal
ler
y{di
spl
ay:f
lex;
fl
ex-
flow:r
owwr
ap;
jus
tif
y-c
ont
ent
:spac
e-bet
ween;
al
ign-
items
:cent
er;
}
.
image-
gal
ler
yimg{
widt
h:25%;
hei
ght
:250px;
}
<
/st
yle>
<
/head>
<
body>
<
divc
las
s="
image-
gal
ler
y">
<
imgs
rc="
images
/red-
flower
.j
pg"al
t="
RedFl
ower
">
<
imgs
rc="
images
/whi
te-
flower
.j
pg"al
t="
Whi
teFl
ower
">
<
imgs
rc="
images
/or
ange-
flower
.j
pg"al
t="
OrangeFl
ower
">
<
/di
v>
<
/body>
<
/ht
ml>
 Mul
tiBac
kgr
ound

CSSMul
tibac
kgr
oundpr
oper
tyi
sus
edt
oaddoneormor
eimagesatat
imewi
thout
HTMLc
ode,Wec
anaddi
magesasperourr
equi
rement
.As
ampl
esynt
axofmul
ti
bac
kgr
oundi
magesi
sasf
oll
ows
.

#mul
ti
bac
kgr
ound{
bac
kgr
ound-
image:ur
l(/
css
/images
/logo.
png)
,ur
l(/
css
/images
/bor
der
.png)
;
bac
kgr
ound-
pos
iti
on:l
eftt
op,
lef
ttop;
bac
kgr
ound-
repeat
:no-
repeat
,repeat
;
paddi
ng:75px;
}

Tabl
e:2.
5.Bac
kgr
oundpr
oper
tyval
ues

54
Sr
.No. Val
ue&Des
cri
pti
on

1 Bac
kgr
ound:
Usedt
oset
tingal
lthebac
kgr
oundi
magepr
oper
tiesi
none
s
ect
ion

2 bac
kgr
ound-
cli
p:Us
edt
odec
lar
ethepai
nti
ngar
eaoft
hebac
kgr
ound

3 bac
kgr
ound-
image:
Usedt
ospec
ifyt
hebac
kgr
oundi
mage

4 bac
kgr
ound-
ori
gin:
Usedt
ospec
ifypos
iti
onoft
hebac
kgr
oundi
mages

5 bac
kgr
ound-
siz
e:Us
edt
ospec
ifys
izeoft
hebac
kgr
oundi
mages

Ex
ampl
e:

<
html
>
<
head>
<
styl
e>
#mul
ti
bac
kgr
ound {
bac
kgr
ound-
image: ur
l(/
css
/images
/logo.
png)
,
ur
l(/
css
/images
/bor
der
.png)
;
bac
kgr
ound-
pos
iti
on:l
eftt
op,
lef
ttop;
bac
kgr
ound-
repeat
:no-
repeat
,repeat
;
paddi
ng:75px;
}
<
/st
yle>
<
/head>
<
body>
<
divi
d="
mul
ti
bac
kgr
ound"
>
<
h1>
www.
tmpt
c.c
om<
/h1>
<
p>
Ent
oto Pol
ytec
hni
c Col
lege (
EPTC) t
he f
ormer Taf
eriMekonen Sc
hool was
es
tabl
ishedi
n1917E.
Casapr
imar
ysc
hoolandwor
kedasc
ompl
ement
arys
chool
.
Thec
oll
egehast
oday’
snameandt
asks
tar
tingf
rom 1994E.
C.Thec
oll
egepr
ovi
des
voc
ati
onalt
rai
ning i
n 11 oc
cupat
ionals
ect
orsnamel
y:f
inear
tsand aes
thet
ic,

55
aut
omot
ive,manuf
act
uri
ng,c
ons
truc
tion,el
ect
ric
alel
ect
roni
cs,i
nfor
mat
ion and
c
ommuni
cat
ion t
echnol
ogy,t
ext
il
eleat
herand gar
ment
,woodwor
k,bus
ines
s,
s
urveyi
ng,
draf
ti
ng,
andur
banandl
and,
bus
ines
s,andur
banagr
icul
tur
e. <
/p>
<
/di
v>
<
/body>
<
/ht
ml>
 Si
zeofMul
tibac
kgr
ound

Mul
tibac
kgr
oundpr
oper
tyi
sac
cept
edt
oadddi
ff
erents
izesf
ordi
ff
erenti
mages
.A
s
ampl
esynt
axi
sass
hownbel
ow−

#mul
ti
bac
kgr
ound{
bac
kgr
ound: ur
l(/
css
/imal
ges
/logo.
png) l
eft t
op no-
repeat
,
ur
l(/
css
/images
/boar
der
.png)r
ightbot
tom no-
repeat
,ur
l(/
css
/images
/cs
s.gi
f)l
eft
t
opr
epeat
;
bac
kgr
ound-
siz
e:50px,
130px,
aut
o;
}
Ass
hownaboveanexampl
e,eac
himagei
shavi
ngs
pec
ifi
csi
zesas50px,130pxand
aut
osi
ze.

 Gr
adi
ent
s

Whati
sGr
adi
ent
s?

Gr
adi
ent
sdi
spl
ayst
hec
ombi
nat
ionoft
woormor
ecol
ors
.

Typesofgr
adi
ent
s

Li
nearGr
adi
ent
s(down/
up/
lef
t/r
ight
/di
agonal
ly)

Radi
alGr
adi
ent
s

Li
neargr
adi
ent
sar
eus
edt
oar
ranget
woormor
ecol
orsi
nli
nearf
ormat
sli
ket
opt
o
bot
tom.

Topt
obot
tom

56
<
html
>
<
head>
<
styl
e>
#gr
ad1{
hei
ght
:100px;
bac
kgr
ound:
-webki
t-l
inear
-gr
adi
ent
(pi
nk,
green)
;
bac
kgr
ound:
-o-
li
near
-gr
adi
ent
(pi
nk,
green)
;
bac
kgr
ound:
-moz
-li
near
-gr
adi
ent
(pi
nk,
green)
;
bac
kgr
ound:
linear
-gr
adi
ent
(pi
nk,
green)
;
}
<
/st
yle>
<
/head>
<
body>
<
divi
d="
grad1"
></
div>
<
/body>
<
/ht
ml>

Out
put
:

Lef
ttor
ight
-exampl
e

bac
kgr
ound:
linear
-gr
adi
ent
(tor
ight
,red,
blue)
;

57
Di
agonal
:exampl
e

Di
agonals
tar
tsatt
opl
eftandr
ightbut
ton.

bac
kgr
ound:
-webki
t-l
inear
-gr
adi
ent
(lef
ttop,
red,
blue)
;

bac
kgr
ound:
-o-
li
near
-gr
adi
ent
(bot
tomr
ight
,red,
blue)
;

Mul
tic
olor

bac
kgr
ound:
-webki
t-l
inear
-gr
adi
ent
(red,
orange,
yel
low,
red,
blue,
green,
pink)
;

2.
2.PAGELAYOUTCREATI THC
ONWI SS
2.
2.1.
CSSWebs
iteLayout

Awebs
itei
sof
tendi
videdi
ntoheader
s,menus
,cont
entandaf
oot
er:

58
Ther
ear
etonsofdi
ff
erentl
ayoutdes
ignst
ochoos
efr
om.However
,thes
truc
tur
e
above,
isoneoft
hemos
tcommon,
andwewi
llt
akeac
los
erl
ookati
tint
hist
utor
ial
.

 Header

Aheaderi
sus
ual
lyl
ocat
edatt
het
opoft
hewebs
ite(
orr
ightbel
owat
opnavi
gat
ion
menu)
.Itof
tenc
ont
ainsal
ogoort
hewebs
itename:

 Navi
gat
ionBar

Anavi
gat
ionbarc
ont
ainsal
istofl
inkst
ohel
pvi
si
tor
snavi
gat
ingt
hroughyour
webs
ite:

Thel
ayouti
nthi
ssec
tion,of
tendependsont
het
argetus
ers
.Themos
tcommon
l
ayouti
sone(
orc
ombi
ningt
hem)oft
hef
oll
owi
ng:

1-
col
umn(
oft
enus
edf
ormobi
lebr
ows
ers
)

2-
col
umn(
oft
enus
edf
ort
abl
etsandl
apt
ops
)

3-
col
umnl
ayout(
onl
yus
edf
ordes
ktops
)

59
Wewi
llc
reat
ea3-
col
umnl
ayout
,andc
hangei
ttoa1-
col
umnl
ayoutons
mal
ler
s
creens
:

 UnequalCol
umns

Themai
ncont
enti
sthebi
gges
tandt
hemos
timpor
tantpar
tofyours
ite.

I
tisc
ommonwi
thunequalc
olumnwi
dths
,sot
hatmos
toft
hes
pac
eisr
eser
vedf
or
t
hemai
ncont
ent
.Thes
idec
ont
ent(
ifany)i
sof
tenus
edasanal
ter
nat
ivenavi
gat
ion
ort
ospec
ifyi
nfor
mat
ionr
elevantt
othemai
ncont
ent
.

 Foot
er

Thef
oot
eri
spl
acedatt
hebot
tom ofyourpage.I
tof
tenc
ont
ainsi
nfor
mat
ionl
ike
c
opyr
ightandc
ont
acti
nfo:

60
2.
3. POSI
TIONI THC
NGDOCUMENTELEMENTSWI SS
I
. pos
iti
on:s
tat
ic

HTMLel
ement
sar
epos
iti
oneds
tat
icbydef
aul
t.

St
ati
cpos
iti
onedel
ement
sar
enotaf
fec
tedbyt
het
op,bot
tom,l
eft
,andr
ight
pr
oper
ties
.

Anel
ementwi
thpos
iti
on:s
tat
ic;i
snotpos
iti
onedi
nanys
pec
ialway;i
tisal
ways
pos
iti
onedac
cor
dingt
othenor
malf
lowoft
hepage:

Exampl
e

di
v.St
ati
c{
pos
iti
on:s
tat
ic;
bor
der
:3pxs
oli
d#73AD21;
}

I
I. Rel
ati
vePos
iti
oni
ng

Anel
ementwi
thpos
iti
on:r
elat
ive;i
spos
iti
onedr
elat
ivet
oit
snor
malpos
iti
on.

Set
tingt
het
op,r
ight
,bot
tom,andl
eftpr
oper
tiesofar
elat
ivel
y-pos
iti
onedel
ement
wi
llc
aus
eitt
obeadj
ust
edawayf
rom i
tsnor
malpos
iti
on.Ot
herc
ont
entwi
llnotbe
adj
ust
edt
ofi
tint
oanygapl
eftbyt
heel
ement
.

MoveLef
t-Us
eanegat
iveval
uef
orl
eft
.

MoveRi
ght-Us
eapos
iti
veval
uef
orl
eft
.

MoveUp-Us
eanegat
iveval
uef
ort
op.

MoveDown-Us
eapos
iti
veval
uef
ort
op.

NOTE−Youc
anus
ebot
tom orr
ightval
uesaswel
lint
hes
amewayast
opandl
eft
.

Ex
ampl
e

<
html
>

61
<
head>
<
/head>
<
body>
<
divs
tyl
e="
pos
iti
on:
rel
ati
ve;l
eft
:80px;t
op:
2px;bac
kgr
ound-
col
or:
yel
low;
">
Thi
sdi
vhasr
elat
ivepos
iti
oni
ng.
<
/di
v>
<
/body>
<
/ht
ml>

I
II
. Abs
olut
ePos
iti
oni
ng

An el
ementwi
th pos
iti
on:abs
olut
e;i
s pos
iti
oned r
elat
ive t
othe near
est
pos
iti
onedanc
est
or(
ins
teadofpos
iti
onedr
elat
ivet
othevi
ewpor
t,l
ikef
ixed)
.

However
;ifanabs
olut
epos
iti
onedel
ementhasnopos
iti
onedanc
est
ors
,itus
est
he
doc
umentbody,
andmovesal
ongwi
thpages
crol
li
ng.

MoveLef
t-Us
eanegat
iveval
uef
orl
eft
.

MoveRi
ght-Us
eapos
iti
veval
uef
orl
eft
.

MoveUp-Us
eanegat
iveval
uef
ort
op.

MoveDown-Us
eapos
iti
veval
uef
ort
op.

NOTE−Youc
anus
ebot
tom orr
ightval
uesaswel
lint
hes
amewayast
opandl
eft
.

Exampl
e

<
html
>
<
head>
<
/head>
<
body>
<
divs
tyl
e="
pos
iti
on:
abs
olut
e;l
eft
:80px;t
op:
20px;bac
kgr
ound-
col
or:
yel
low;
">
Thi
sdi
vhasabs
olut
epos
iti
oni
ng.

62
<
/di
v>
<
/body>
<
/ht
ml>

I
V. Fi
xedPos
iti
oni
ng

Anel
ementwi
thpos
iti
on:f
ixed;i
spos
iti
onedr
elat
ivet
othevi
ewpor
t,whi
chmeans
i
tal
wayss
taysi
nthes
amepl
aceeveni
fthepagei
ssc
rol
led.Thet
op,r
ight
,bot
tom,
andl
eftpr
oper
tiesar
eus
edt
opos
iti
ont
heel
ement
.

Af
ixedel
ementdoesnotl
eaveagapi
nthepagewher
eitwoul
dnor
mal
lyhavebeen
l
ocat
ed.

MoveLef
t-Us
eanegat
iveval
uef
orl
eft
.

MoveRi
ght-Us
eapos
iti
veval
uef
orl
eft
.

MoveUp-Us
eanegat
iveval
uef
ort
op.

MoveDown-Us
eapos
iti
veval
uef
ort
op.

NOTE−youc
anus
ebot
tom orr
ightval
uesaswel
lint
hes
amewayast
opandl
eft
.

Ex
ampl
e

<
html
>
<
head>
<
/head>
<
body>
<
divs
tyl
e="
pos
iti
on:
fi
xed;l
eft
:80px;t
op:
20px;bac
kgr
ound-
col
or:
yel
low;
">
Thi
sdi
vhasf
ixedpos
iti
oni
ng.
<
/di
v>
<
/body>
<
/ht
ml>

63
2.
4. STYLESHEETSAPPLI
CATI
ONONMULTI
PLEPAGESONAWEBSI
TE

The<
li
nk>el
ementc
anbeus
edt
oinc
ludeanext
ernals
tyl
esheetf
il
einyourHTML
doc
ument
.

Anext
ernals
tyl
esheeti
sas
epar
atet
extf
il
ewi
th.
cssext
ens
ion.Youdef
ineal
lthe
St
yler
uleswi
thi
nthi
stextf
il
eandt
henyouc
ani
ncl
udet
hisf
il
einanyHTML
doc
umentus
ing<
li
nk>el
ement
.

Her
eist
hegener
ics
ynt
axofi
ncl
udi
ngext
ernalCSSf
il
e

<
head>

<
li
nkr
el="
styl
esheet
"ty
pe="
text
/cs
s"hr
ef="
styl
es.
css
">

<
/head>

I
mpor
tedCSS-@i
mpor
tRul
e

@i
mpor
tisus
edt
oimpor
tanext
ernals
tyl
esheeti
namanners
imi
lart
othe<
li
nk>
el
ement
.Her
eist
hegener
ics
ynt
axof@i
mpor
trul
e.

<
head>
@i
mpor
t"URL"
;
<
/head>
Her
eURLi
stheURLoft
hes
tyl
esheetf
il
ehavi
ngs
tyl
erul
es.Youc
anus
eanot
her
s
ynt
axaswel
l–

<
head>
@i
mpor
tur
l("
URL"
);
<
/head>
Ex
ampl
e

Fol
lowi
ngi
stheexampl
eshowi
ngyouhow t
oimpor
tas
tyl
esheetf
il
eint
oHTML
doc
ument−

64
<
head>
@i
mpor
t"mys
tyl
e.c
ss"
;
<
/head>

2.
5. WEBPAGESCREATI
ONFORVARI
EDSCREENRESOLUTI
ONS

2.
5.1.Res
pons
iveWebDes
ign

Res
pons
ivewebdes
ignpr
ovi
desanopt
imalexper
ienc
e,eas
yreadi
ngandeas
y
navi
gat
ion wi
th ami
nimum ofr
esi
zi
ng on di
ff
erentdevi
cess
uch asdes
ktops
,
mobi
lesandt
abs
).

Bel
owi
mages
howst
her
espons
ives
truc
tur
eofwebpages
.

Fi
g:2.
3Res
pons
iveWebDes
ign

Fl
exi
bleGr
id

65
<
html
>
<
head>
<
styl
e>
body{
f
ont
:60014px/
24px"
OpenSans
",
"
Hel
vet
icaNeue-
Light
",
"
Hel
vet
icaNeueLi
ght
",
"
Hel
vet
icaNeue"
,
Hel
vet
ica,
Ari
al,
"
Luc
idaGr
ande"
,
Sans
-Ser
if
;
}
h1{
c
olor
:#9799a7;
f
ont
-si
ze:14px;
f
ont
-wei
ght
:bol
d;
mar
gin-
bot
tom:6px;
}
.
cont
ainer
:bef
ore,
.cont
ainer
:af
ter{
c
ont
ent
:""
;
di
spl
ay:t
abl
e;
}
.
cont
ainer
:af
ter{
c
lear
:bot
h;
}
.
cont
ainer{
bac
kgr
ound:
#eaeaed;
mar
gin-
bot
tom:24px;
*z
oom:1;
}

66
.
cont
ainer
-75{
wi
dth:
75%;
}
.
cont
ainer
-50{
mar
gin-
bot
tom:0;
wi
dth:
50%;
}
.
cont
ainer
,sec
tion,
asi
de{
bor
der
-radi
us:6px;
}
s
ect
ion,
asi
de{
bac
kgr
ound:
#2db34a;
c
olor
:#f
ff;
mar
gin:1.
858736059%;
paddi
ng:20px0;
t
ext
-al
ign:c
ent
er;
}
s
ect
ion{
f
loat
:lef
t;
wi
dth:
63.
197026%;
}
as
ide{
f
loat
:ri
ght
;
wi
dth:
29.
3680297%;
}
<
/st
yle>
<
/head>
<
body>
<
h1>
100% Wi
deCont
ainer
</h1>
<
divc
las
s="
cont
ainer
">

67
<
sec
tion>
Sec
tion<
/sec
tion>
<
asi
de>
Asi
de<
/as
ide>
<
/di
v>

<
h1>
75% Wi
deCont
ainer
</h1>
<
divc
las
s="
cont
ainerc
ont
ainer
-75"
>
<
sec
tion>
Sec
tion<
/sec
tion>
<
asi
de>
Asi
de<
/as
ide>
<
/di
v>
<
h1>
50% Wi
deCont
ainer
</h1>
<
divc
las
s="
cont
ainerc
ont
ainer
-50"
>
<
sec
tion>
Sec
tion<
/sec
tion>
<
asi
de>
Asi
de<
/as
ide>
<
/di
v>
<
/body>
<
/ht
ml>

Out
put
:

68
 Medi
aquer
ies

Medi
aquer
iesi
sfordi
ff
erents
tyl
erul
esf
ordi
ff
erents
izedevi
cess
uchasmobi
les
,
des
ktops
,et
c.,

<
html
>
<
head>
<
styl
e>
body{
bac
kgr
ound-
col
or:l
ight
pink;
}
@medi
asc
reenand(
max-
widt
h:420px){
body{
bac
kgr
ound-
col
or:l
ight
blue;
}}
<
/st
yle>
<
/head>
<
body>
<
p>
I
fsc
reens
izei
sles
sthan420px,
theni
twi
lls
howl
ight
blue
c
olor
,orel
sei
twi
lls
howl
ightpi
nkc
olor
<
/p>
<
/body>
<
/ht
ml>

69
2.
6.APPLI
CATI NGFORTHEDESI
ONLAYERI REDDESI
GN

Appl
icat
ionl
ayer
ingi
nthec
ont
extofwebdevel
opmentr
efer
stot
heor
gani
zedand
s
truc
tur
ed appl
icat
ion of di
ff
erent l
ayer
s of des
ign el
ement
s,s
tyl
es,and
f
unc
tional
it
ytoac
hieveades
iredover
alldes
ignf
orawebs
ite.
Thi
sappr
oac
hhel
psi
n
c
reat
ingamodul
arandmai
ntai
nabl
edes
igns
yst
em.I
nCSS,t
hez
-indexpr
oper
tyi
s

UNI
TTHREE:WEBPAGEANDCSSVALI
DATI
ONANDTESTI
NG

Thi
suni
tisdevel
opedt
opr
ovi
deyout
henec
ess
aryi
nfor
mat
ionr
egar
dingt
hef
oll
owi
ng
c
ont
entc
over
ageandt
opi
cs:
 CSSs
tandar
dandval
idat
ion
 Webpageeval
uat
ionac
ros
svar
iousbr
ows
ers
 Rec
tif
icat
ionofbr
ows
er
Thi
suni
twi
llal
soas
sis
tyout
oat
tai
nthel
ear
ningout
comess
tat
edi
nthec
overpage.
Spec
ifi
cal
ly,
uponc
ompl
eti
onoft
hisl
ear
ninggui
de,
youwi
llbeabl
eto:
 Val
idat
eCSSagai
nsti
ndus
trys
tandar
ds
 Tes
tawebpagei
nvar
iousbr
ows
ers
 Rec
tif
ybr
ows
erdi
ff
erenc
est
oens
urewebs
itei
sac
ces
sibl
e
 Expl
oret
echni
quesf
orhandl
ingbr
ows
er-
spec
ifi
cst
yli
ngc
hal
lenges

 Emphas
izet
hei
mpor
tanc
eofadher
ingt
oindus
trys
tandar
dsi
nCSS

us
edf
orc
ont
rol
li
ngt
hes
tac
kingor
derofpos
iti
onedel
ement
s

70
3.
1. CSSSTANDARDANDVALI
DATI
ON

Val
idat
ionofCSSc
odef
ors
tandar
dsc
ompl
ianc
ehass
omeadvant
agesandi
sno
di
ff
erentf
romHTMLval
idat
ion.
Adoc
umentwi
thCSSc
odewi
llbec
ons
ider
edval
idi
f
i
thaspas
sedt
hec
orr
espondi
ngc
hec
kanddoesnotc
ont
ainer
ror
s.

I
fyouus
est
yles
heet
spr
edomi
nant
lyi
nanext
ernalf
il
e,t
hismakesi
tmuc
heas
iert
o
c
hec
kyourc
odebec
aus
eyouhavet
ochec
konl
yonef
il
e,noteac
hpagei
ndi
vidual
ly.
I
fyoumakemi
stakeswhenwr
iti
ngs
tyl
esheetc
ode,youc
anal
sous
eaval
idat
ort
o
notl
ookf
orer
ror
smanual
ly.

Howt
ous
etheval
idat
or?

Youc
anus
eaCSSval
idat
ort
ochec
kCSSc
odef
orer
ror
sands
tandar
dsc
ompl
ianc
e,
whi
chpr
ovi
dest
hreewayst
ochec
k:

URLver
ifi
cat
ion

J
ustent
ert
heURLoft
hewebpageyouwantt
ochec
kandc
lic
ktheChec
kbut
ton.

Af
terval
idat
ingt
hec
odewi
thaval
idat
or,
youwi
lls
eeoneoft
woi
nsc
ript
ions
-ei
ther
t
hatever
ythi
ngwass
ucc
ess
fulandyouc
ongr
atul
atewi
tht
heval
idc
ode,ort
hat

71
yourCSSc
odef
ounder
ror
sthatyouar
eaboutt
ofi
x.

Chec
kingt
hedownl
oadedf
il
e

Thi
smet
hodal
lowsyout
odownl
oadt
hes
canneddoc
umentt
othes
erver
.Todot
his
,
c
lic
ktheBr
ows
ebut
tonands
elec
tthef
il
ethatyouwantt
ochec
k.

Thes
erverwi
llaut
omat
ical
lyr
ecogni
zet
het
ypeoff
il
eyouar
edownl
oadi
ng.

Chec
kingpas
tedc
ode

Thi
smet
hodi
sidealf
orval
idat
ingpar
tofaCSSf
il
e.Youonl
yneedt
ocopyt
hec
ode
i
ntot
het
extbox
.

72
3.
2. WEBPAGEEVALUATI
ONACROSSVARI
OUSBROWSERS

Br
ows
erc
ompat
ibi
li
tyorc
ros
s-br
ows
ert
est
ingi
sapr
oces
sofeval
uat
ingwhet
her
t
hef
unc
tional
it
yofawebappl
icat
ionr
emai
nsc
ons
ist
entwhent
heend-
uservi
si
ts
yourweb-
appl
icat
ionf
rom adi
ff
erentbr
ows
er.I
tisal
sous
edt
oval
idat
ebr
ows
er
c
ompat
ibi
li
tyf
ordes
ktopandwebappl
icat
ions
.

WhatFeat
uresAr
eAnal
yzedi
naBr
ows
erTes
t?

1.Bas
icf
unc
tional
it
y:Toens
uret
hats
impl
est
uffi
swor
kingonmos
tbr
ows
er-
OS
c
ombi
nat
ions

 Al
linputf
iel
dsandt
hei
rval
idat
ion

 Di
alogboxesandmenusar
ewor
kingasexpec
ted

 I
nputt
ouc
honmobi
ledevi
ces

2.
Des
ign:Tomakes
uref
ont
s,s
tyl
es,
images
,andl
ayout
sar
emat
chi
ngr
equi
rement
s
t
hatwer
esentbydes
igner
s

3.
Res
pons
ivenes
s:Ver
ifyt
hatdes
igni
ssol
idandnotbr
okeni
nsomel
ayer
saf
teryou
c
hanget
her
esol
uti
on/
ori
ent
ati
onofabr
ows
er

73
 Howt
oChoos
eBr
ows
ers
?

Ther
ear
etwoeas
ywayst
ochoos
efr
omal
lthevar
iet
yofbr
ows
ers

1.Bas
edonpopul
ari
ty:Choos
ebr
ows
erst
hatc
anover
comet
he5% bar
rieri
ngl
obal
s
tat
ist
ics
.So,f
orexampl
e,i
n2020youwoul
dchoos
eGoogl
eChr
ome,Saf
ari
,Moz
ill
a
Fi
ref
ox,Mi
cros
oftEdge,andI
E.Regar
dingI
E,i
tisabi
ttr
ickybec
aus
ether
ear
eal
ot
ofver
sionsoft
hisbr
ows
er.Ourr
ecommendat
ioni
stos
uppor
tonl
yIE10,
ther
eas
on
bei
ngt
hatI
E8and9ar
etoool
dandhar
dtos
uppor
t.

2.
Bas
edont
heanal
ysi
s:I
fyouhaves
omeanal
yti
cst
ool
s(Googl
eAnal
yti
cs,
etc
.)t
hat
ar
etr
acki
ng al
ltr
aff
ics
tat
s,you wi
llhaveaf
ullunder
standi
ng ofwhatyour
c
ust
omer
sar
eus
ing,andi
twi
llbeaneas
ydec
isi
ont
omake.I
fnot
,youmayt
ryt
o
knowy
ourc
ust
omerbet
terbyc
reat
ings
omepol
ls,
etc
.Woul
ditbewor
tht
osuppor
t
al
lthever
sionsofdi
ff
erentbr
ows
ers
?Itdependsoni
fyouagr
eet
hatdevel
opment
andt
est
ingt
imewi
llbehi
gherever
yti
me.Ei
therway,
int
hel
ongr
un,
youwi
llhave
t
osac
rif
ices
uppor
tingol
dver
sions
.

Thedec
isi
ononwhi
chbr
ows
ersandpl
atf
ormst
ochoos
edependsont
hebus
ines
s
t
eamandt
hemar
ket
ingt
eam.

3.
3. RECTI
FICATI
ONOFBROWSER

Cr
oss
-br
ows
erc
ompat
ibi
li
tyi
ssuesc
an beamaj
orpai
nforwebdevel
oper
sas
di
ff
erentbr
ows
ersof
ten r
enderweb pagesdi
ff
erent
ly.However
,wi
th pr
oper
pl
anni
ngandt
heus
eofCSS,t
hes
eis
suesc
anber
esol
ved.I
nthi
sar
tic
le,wewi
ll
expl
orehowt
osol
vec
ros
s-br
ows
erc
ompat
ibi
li
tyi
ssueswi
thCSS.

 Nor
mal
izeCSS:Oneoft
hef
ir
sts
tepsi
nsol
vingc
ros
s-br
ows
erc
ompat
ibi
li
ty
i
ssuesi
stous
eaCSSnor
mal
izat
ionl
ibr
arys
uchasNor
mal
ize.
css
.Thi
sli
brar
y
makess
uret
hatdef
aul
tst
ylesar
econs
ist
entac
ros
sdi
ff
erentbr
ows
ers
,whi
ch
c
anhel
pres
olvemanyc
ommonc
ompat
ibi
li
tyi
ssues
.

 Us
evendorpr
efi
xes
:Vendorpr
efi
xesar
espec
ialCSSpr
oper
tiesandval
ues
t
hatar
eus
edt
oens
uret
hats
tyl
esar
erender
edc
ons
ist
ent
lyac
ros
sdi
ff
erent

74
br
ows
ers
.Forexampl
e,t
heCSSpr
oper
ty“
trans
for
m”i
spr
efi
xedwi
th“
-webki
t
-
”forWebki
t-bas
edbr
ows
ersl
ikeChr
omeandSaf
ari
,“-
moz
-”f
orMoz
ill
a
Fi
ref
ox,
and“
-ms
-”f
orMi
cros
oftI
nter
netExpl
orer
.

Tes
tonmul
ti
plebr
ows
ers
:Toens
uret
hatyours
tyl
esar
ecompat
ibl
ewi
thdi
ff
erent
br
ows
ers
,iti
simpor
tantt
otes
tyours
tyl
esonmul
ti
plebr
ows
ers
.Thi
scanbedone
byi
nst
all
ingdi
ff
erentbr
ows
ersonyourdevel
opmentmac
hineorbyus
ingonl
ine
t
ool
ssuc
hasBr
ows
erSt
ackorCr
ossBr
ows
erTes
ting.

 Us
eCSSRes
ets
:CSSRes
etsar
eas
etofs
tyl
est
hatar
eus
edt
ores
ett
he
def
aul
tst
ylesofdi
ff
erentel
ement
stoac
ons
ist
ents
tat
e.Thi
scan hel
p
r
esol
vec
ompat
ibi
li
tyi
ssuesbyens
uri
ngt
hatt
hes
tyl
esappl
iedt
oanel
ement
ar
ethes
ameac
ros
sdi
ff
erentbr
ows
ers
.

 Avoi
dbr
ows
er-
spec
ifi
chac
ks:Br
ows
er-
spec
ifi
chac
ksar
eCSSs
tyl
est
hatar
e
s
pec
ifi
cal
lydes
ignedt
owor
kwi
thapar
tic
ularbr
ows
erandar
eof
tenus
edt
o
r
esol
vec
ompat
ibi
li
tyi
ssues
.However
,thes
ehac
ksc
anmakeyours
tyl
esheet
di
ff
icul
tto mai
ntai
n and c
an al
soc
aus
ecompat
ibi
li
tyi
ssueswi
th ot
her
br
ows
ers
.

 Us
efeat
uredet
ect
ion:Feat
uredet
ect
ion i
sat
echni
quet
hati
sus
ed t
o
det
ermi
newhet
herapar
tic
ularf
eat
urei
ssuppor
tedbyt
heus
er’
sbr
ows
er.
Thi
scanbeus
efuli
nsol
vingc
ompat
ibi
li
tyi
ssuesbyal
lowi
ngyout
oappl
y
s
tyl
esonl
ytobr
ows
erst
hats
uppor
tapar
tic
ularf
eat
ure.

 Us
eCSSf
ramewor
ks:CSSf
ramewor
kss
uchasBoot
str
apandFoundat
ionc
an
beus
efult
ool
sins
olvi
ngc
ros
s-br
ows
erc
ompat
ibi
li
tyi
ssuesast
heypr
ovi
dea
c
ons
ist
ents
etofs
tyl
est
hatar
etes
tedac
ros
smul
ti
plebr
ows
ers
.

SELF-
CHECK-
3
Par
tI:Mul
ti
plec
hoi
ce

1)Whati
sthepur
pos
eofCSSval
idat
ion?

75
A.Enhanc
ingwebs
iteaes
thet
ics C.
Chec
kingc
odeagai
nst
s
pec
ifi
cat
ions

B.Opt
imi
zi
ngdat
abas
eper
for
manc
e D.
Impr
ovi
ngs
erverr
espons
e
t
ime

2)Whi
cht
ooli
scommonl
yus
edf
orCSSval
idat
ion?

A.Phot
oshop

B.W3CCSSVal
idat
ionSer
vic
e

C.Vi
sualSt
udi
oCode

D.Boot
str
ap

3)Whyi
stes
tingwebpagesac
ros
sdi
ff
erentbr
ows
ersi
mpor
tant
?

A.Toi
ncr
eas
eser
vers
peed

B.Toens
ureac
ons
ist
entus
erexper
ienc
e

C.Tor
educ
ethes
izeofCSSf
il
es

D.Toenhanc
eSEOr
anki
ng

Par
tII
Gives
hor
tans
wer

1)Whyi
siti
mpor
tantt
oadher
etoCSSs
tandar
ds?

2)Whati
sCSSval
idat
ion,
andwhys
houl
dwebdevel
oper
sval
idat
ethei
rCSSc
ode?

3)Nameapopul
art
oolf
orCSSval
idat
ionandbr
ief
lyexpl
ainhowi
twor
ks.

4)Whyi
siti
mpor
tantt
otes
twebpagesac
ros
sdi
ff
erentbr
ows
ers
?

Par
tII
I SayTr
ueorFal
se

1) Cr
oss
-br
ows
ert
est
ingi
snec
ess
arybec
aus
eal
lbr
ows
ersi
nter
pretHTMLandCSS
i
ntheexac
tsameway.

2) Us
ingbr
ows
erdevel
opert
ool
s,devel
oper
scani
dent
if
yandf
ixbr
ows
er-
spec
ifi
c

76
i
ssuesi
nCSSc
ode.

3) I
gnor
ingbr
ows
erdi
ff
erenc
esi
sar
ecommendeds
trat
egyf
orhandl
ingc
ros
s-
br
ows
erc
ompat
ibi
li
tyi
ssues
.

OPERATI
ONSHEET-
3.1

OPERATI
ONT TLE:
I CSSVALI
DATI THW3
ONWI CCSSVALI ONS
DATI ERVI
CE
Purpose:Vali
dateCSSCode

Requi
redt
ool
sandequi
pment
:Int
ernetandc
omput
er

St
eps

St
ep-
1Opent
heW3CCSSVal
idat
ionSer
vic
e:

Got
otheW3CCSSVal
idat
ionSer
vic
ewebs
ite(
htt
ps:
//j
igs
aw.
w3.
org/
css
-val
idat
or/
).

St
ep-
2Choos
eVal
idat
ionMet
hod:

Ther
ear
etwoval
idat
ionmet
hods
:"ByURL"or"
ByFi
leUpl
oad.
"

I
fyourCSSc
odei
sinaf
il
e,c
hoos
e"ByFi
leUpl
oad"andupl
oadyourCSSf
il
e.

I
fyourCSSc
odei
sonawebpage,
choos
e"ByURL"andent
ert
heURL.

77
St
ep-
3Submi
tandVal
idat
e:

Cl
ickt
he"
Chec
k"or"
Val
idat
ebyFi
leUpl
oad"but
ton,dependi
ngonyourc
hos
en
met
hod.

Revi
ewt
heRes
ult
s:

Theval
idat
ions
ervi
cewi
llanal
yzeyourCSSc
odeanddi
spl
ayt
her
esul
ts.

Chec
kforanyer
ror
sorwar
ningsr
epor
ted.Er
ror
sneed t
obef
ixed t
oens
ure
c
ompl
ianc
ewi
thCSSs
tandar
ds.

St
ep-
4Navi
gat
etoEr
rorDet
ail
s:

I
fther
e ar
e er
ror
sorwar
nings
,cl
ick on t
he er
rormes
sagest
osee det
ail
ed
i
nfor
mat
ionabouteac
his
sue.

Under
standt
henat
ureoft
hepr
obl
emsandpl
anf
orc
orr
ect
ions
.

St
ep-
5Cor
rec
ttheCSSCode:

OpenyourCSSf
il
eus
ingat
extedi
tor
.

Loc
ateandf
ixt
hei
ssuesi
dent
if
iedbyt
heval
idat
ions
ervi
ce.

Commoni
ssuesi
ncl
udes
ynt
axer
ror
s,uns
uppor
tedpr
oper
ties
,ormi
sspel
ledval
ues
.

St
ep-
6Reval
idat
e:

Af
termaki
ngc
orr
ect
ions
,gobac
ktot
heW3CCSSVal
idat
ionSer
vic
e.

Repeatt
heval
idat
ionpr
oces
stoens
uret
hatal
lis
sueshavebeenaddr
ess
ed.

St
ep-
7Repeatf
orEac
hPage:

Qual
it
ycr
iter
ia:Cr
eat
eer
rorf
reec
ode

78
LAPTESTS
I
nstr
ucti
ons:Gi
vennec
essar
ytemplates,
tool
sandmat
eri
alsyouar
erequi
redt
o
per
formthefol
lowi
ngtas
ksaccor
dingly.
Tas
k1:val
idat
eCSSc
odewi
thW3CCSSVal
idat
ionSer
vic
e
Tas
k2:Cr
oss
-Br
ows
erTes
tingUs
ingBr
ows
erDevel
operTool
s

79
REFERENCES

Books
1.WebDes
ignwi
thHTMLandCSSDi
git
alCl
ass
roomJ
eremyOs
bor
n,J
enni
ferSmi
th,
andt
heAGI
Trai
ningTeam

2.HTML&CSS:TheCompl
eteRef
erenc
eThomasA.
Powel
l,f
if
thedi
ti
on,
2010

3.Lear
ntoCodeHTML&CSSDevel
op&St
yleWebs
ites ShayHowe,
2014

4.BEGI
NNI
NGCSS:CASCADI
NGSTYLESHEETSFORWEBDESI
GN I
anPounc
eyRi
char
d
Yor
k,2011,
Thi
rdEdi
ti
on

URL
ht
tps
://
www.
w3s
chool
s.
com/

ht
tps
://
www.
tut
ori
als
poi
nt.
com/
html
/i
ndex.
htm

80

You might also like