Several ways to express colors in CSS
h1 {
color: green
}
h1 {
color: #66cdaa
}
h1 {
color: rgb(102, 205, 170)
}
h1 {
color: rgba(102, 205, 170, 0.25)
}
Introduced with CSS3
Provides an alternative way to express colors based on:
Hue (expressed as an angle between 0 and 360 degrees)
Saturation (expressed as a percentage)
Lightness (expressed as a percentage 0% => white, 50% => normal & 100% => black)
body {
background-color: hsl(0, 0%, 78%);
}
Just like HSL but adds the ability to specify opacity using an alpha value
alpha must be a number between 0.0 and 1.0 (0.5 means 50% opacity)
body {
background-color: hsla(0, 100%, 75%, 0.5);
}