Can you store a hsl color in a css variable? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Can you store a hsl color in a css variable?

Something like: - - color-name: hsl(100,100,100) doesn't work, so is there a way to do it?

30th Jan 2019, 8:56 AM
Alexandru Zmau
Alexandru Zmau - avatar
1 Answer
+ 3
HSL stands for hue, saturation and lightness. So you have to use percentages instead of simple numbers for saturation and lightness in order to get the desired results. So your snippet should be like hsl(100,100%,100%), and that will produce white color for you! For further reference: https://www.w3schools.com/cssref/func_hsl.asp
30th Jan 2019, 9:04 AM
Seniru
Seniru - avatar