צבעים בשפת CSS

ניתן להגדיר צבעים בשפת CSS בשש דרכים שונות:

color name

background-color: red
background-color: green
background-color: white
background-color: black

hexadecimal

background-color: #F00
background-color: #008000
background-color: #FFF
background-color: #000

rgb

background-color: rgb(255,0,0)
background-color: rgb(0,255,0)
background-color: rgb(255,255,255)
background-color: rgb(0,0,0)

rgba

background-color: rgba(255,0,0,1)
background-color: rgba(0,255,0,0.75)
background-color: rgba(255,255,255,0.5)
background-color: rgba(0,0,0,0.25)

hsl

background-color: hsl(0, 100%, 50%)
background-color: hsl(120, 100%, 50%)
background-color: hsl(120, 100%, 100%)
background-color: hsl(0, 0%, 0%)

hsla

background-color: hsla(0, 100%, 50%,0.25)
background-color: hsla(120, 100%, 50%,0.5)
background-color: hsla(120, 100%, 100%,0.75)
background-color: hsla(0, 0%, 0%,1)