hsl() CSS Function
hsl() CSS function is used to set a color value in CSS. The hsl() function takes three values, they are: hue, saturation, and lightness.
hsl() = hsl( <hue>, <saturation>, <lightness> )
- huerepresents an angle of the color circle. You can specify the value as an angle in degrees (e.g. 180deg) or simply as a number (e.g. 180). For example, blue is at 240 degrees, so it could be written as either 240deg or 240. By definition, red=0°=360°, with the other colors spread around the circle, so green=120°, blue=240°, etc.
- saturationsaturation is expressed as a percentage. It represents the amount of saturation in the color. For example, 100% is fully saturated (more colorful and intense), while 0 is a fully-unsaturated gray.
- lightnesslightness is also expressed as a percentage. It represents the amount of light in the color. For lightness, 50% is the "normal" setting, while 100% is white and 0% is black.
<div class='hsl'>This is an example of the hsl() function.</div>
background-color: hsl(240, 100%, 50%);
border: 2px solid red;
|Tablets / Mobile|