Alex Kimu_ Computer Assignment_html
Alex Kimu_ Computer Assignment_html
CUNI
VERSI
TYOFMALAWI
LI
LONGWESATELLI
TECENTRE
FACULTYOFEDUCATI
ON
PROGRAMME: DI
PLOMAI
NEDUCATI
ON
COURSETI
TTLE: WEBDESI
GN
COURSECODE: COMP2201
TO: MR.PHI
RI
FROM: ALEXKI
MU
REGNUMBER: DI
PMC/
2023/
3353
ASSI
GNMENT: 3WAYSOFHOW CANWEDEFI
NECOLORI
N HTMLDOCUMENT
DUEDATE: 13SEPTEMBER,
2024
I
nHTML,col or
scanbedef i
nedinseveralways,andunder
standi
ngthesemethods
al
lowsdevel
operstoenhancethevi
sualappealofwebpages.Herear
et hr
eepr
imary
methodsofdef
ini
ngcol
orinHTML:
1.Hexadeci
malCol
orCodes
Hexadecimal(hex)col
orcodesareoneoft hemostcommonway stodefinecol
orsin
HTML.Ahexcodei sasix-
digi
tcombinat
ionofnumbersandlet
ter
sprecededbya` #`
.
Thesesixdigi
tsrepr
esentt
heint
ensi
tyofred,gr
een,
andblue(
RGB)inacolor.
Hexadeci
mal
Col
orcodei
sst
ruct
uredasf
oll
ows:
Hexcodest
art
swi
tha"
#"sy
mbol
fol
l
owedbysi
xchar
act
ers.
Thef i
rsttwocharacter
sr epresenttheredcomponent
,thenextt
wor
epr
esent
green,andthef
inalt
wor epresentblue.
Forexampl
e:<pst
yle="
col
or:
#FF5733;
">Thi
sisapar
agr
aphwi
thhexcol
or.
</p>
Inthisexample,t
hehexcode` #FF5733`r
epresent
sashadeofor ange.Here’show i
t
breaksdown:FFrepresentst
heredcomponent,whi
chissett
o255( orful
lint
ensi
ty)
,57
represent
st hegreen component
,which i
ssett o 87,and 33 r
epresentstheblue
component ,
whichissetto51.
Insummar y,Hexcodesrangefr
om `00`(noi
ntensi
ty)t
o`FF`(
ful
lintensi
ty)
.This
method offer
s pr
eci
se cont
rolovercol
or,al
l
owing forov
er16 mi l
l
ion possi
ble
combinat
ions.
2.RGB(
Red,
Green,
Blue)Val
ues
Anotherwayt odefi
necolorinHTMListhrough**
RGB* *values,whi
chspeci
fythe
i
ntensit
yofred,gr
een,andbl
ueonascal
ef r
om 0to255.Thismet hodi
sbasedonthe
addi
tivecol
ormodel,
wherecol
orsar
ecr
eatedbycombini
ngtheset hr
eepr
imar
ycolor
s.
RGBcol
orsar
est
ruct
uredasf
oll
ows:
RGBcol
orsar
edef
inedusi
ngt
he`
rgb(
)`f
unct
ion.
The f unct
ion t
akes t
hree v
alues cor
respondi
ng t
ored,gr
een,and bl
ue,
respecti
vel
y .
Forexampl
e:<pst
yle="
col
or:
rgb(
255,
87,
51)
;"
>Thi
sisapar
agr
aphwi
thRGBcol
or.
</p>
I
nthi
sexampl
e:
Ther
edcomponenti
s255(
ful
li
ntensi
ty)
.
Thegr
eencomponenti
s87.
Thebl
uecomponenti
s51.
I
nsummar
y,f
ort
heRGBv
alues:
Eachcolorcomponent(
red,gr
een,andbl
ue)r
angesf
rom 0(
noi
ntensi
ty)t
o255
(f
ull
int
ensit
y).
Unl
ikehexcodes,the`rgb(
)`funct
ionexpl
i
cit
lyl
i
stst
her
ed,gr
een,andbl
ue
component
sasseparat
ev al
ues.
Thi
smet
hodal
l
owsf
orupt
o16,
777,
216col
orcombi
nat
ions(
256^
3).
3.Col
orNames
HTMLsupport
sasetofpr edef
inedcolornamesthatcanbeusedt
ospeci
fycol
ors.Thi
s
methodist
hesimplestandmosti ntuit
ive,asi
tall
owsyoutospeci
fycol
orsbyname
wi
thoutwor
ryi
ngaboutnumer i
cv al
uesorcodes.
Col
ornamesar
est
ruct
uredasf
oll
ows:
Col
orsar
edef
inedbysi
mpl
ywr
it
ingt
hei
rnames,
li
ker
ed,
blue,
green,
etc.
Forexampl
e:<pst
yle="
col
or:
red;
">Thi
sisapar
agr
aphwi
thanamedcol
or.
</p>
Inthisexample,theword"red"i
susedt osetthet extcolor.HTMLsuppor ts140
standar
dcolornames,i
ncl
udingcommoncolor
sli
keblue,gr een,y
ell
ow,pur
ple,orange
andmor especi
fi
cshadesl
ikeli
ght
gray
,dar
kbl
ueorfi
rebrick.
I
nsummar y,namedcolor
sar epredefi
ned,maki ngthem easytouseandunderstand
wit
houtneedi
ngtoremembernumer icvalues.Thismethodisusefulf
orbasi
cdesigns
whereawiderangeofcol
orsisn’
trequired.Thel i
stof140colornamesincl
udesboth
basi
ccolor
sandvari
ousshades.