<div style="background-color: red;">Red</div>
<div style="background-color: #00FF00;">Green (#00FF00)</div>
<div style="background-color: rgb(0, 0, 255);">Blue (rgb)</div>
<div style="background-color: rgba(255, 165, 0, 0.7);">Orange (rgba)</div>
<div style="background-color: hsl(240, 100%, 50%);">Blue (hsl)</div>
<div style="background-color: hsla(120, 100%, 50%, 0.7);">Green (hsla)</div>
<div style="background: linear-gradient(to right, red, blue);">Red-Blue Gradient</div>
Predefined names like red, blue, or
green.
Colors in #RRGGBB format. Example: #FF0000.
Define colors with rgb() or rgba() (with
alpha transparency).
Colors based on Hue, Saturation, Lightness (and Alpha for HSLA).
Example: hsl(240, 100%, 50%).
Used in print, not supported in browsers. Example:
cmyk(0%, 100%, 100%, 0%).
Smooth transition between colors with
linear-gradient().