CSS hsl() Functie
Voorbeeld
Definieer verschillende HSL-kleuren:
#p1 {background-color:hsl(120,100%,50%);} /* green */
#p2 {background-color:hsl(120,100%,75%);} /* light green */
#p3 {background-color:hsl(120,100%,25%);} /* dark green */
#p4 {background-color:hsl(120,60%,70%);} /* pastel green */
Definitie en gebruik
De functie hsl() definieert kleuren met behulp van het Hue-saturation-lightness-model (HSL).
HSL staat voor tint, verzadiging en lichtheid - en vertegenwoordigt een cilindrische coördinatenweergave van kleuren.
Versie: | CSS3 |
---|
Browserondersteuning
De cijfers in de tabel geven de eerste browserversie aan die de functie volledig ondersteunt.
Function | |||||
---|---|---|---|---|---|
hsl() | 1.0 | 9.0 | 1.0 | 3.1 | 9.5 |
CSS-syntaxis
hsl(hue, saturation, lightness)
Value | Description |
---|---|
hue | Defines a degree on the color wheel (from 0 to 360) - 0 (or 360) is red, 120 is green, 240 is blue |
saturation | Defines the saturation; 0% is a shade of gray and 100% is the full color (full saturation) |
lightness | Defines the lightness; 0% is black, 50% is normal, and 100% is white |