Using HSL and HSLA


#1

Why should we change “hsl” to “hsla” when adding an alpha? I used “hsl” and add the opacity value to it and it is still working good.

color: hsl (325, 50%, 50%, 0.6)

https://www.codecademy.com/courses/learn-css-colors/lessons/color/exercises/color-alpha?action=resume_content_item&course_redirect=learn-css


#2

There is no should, here, only how-to.

This is HSL   =>   hsl(325, 50%, 50%)
This is HSLA  =>   hsla(325, 50%, 50%, 0.6)

By adding the alpha channel we no longer need to write a declaration for opacity. The same applies to rgba. This is a convenience, not a should.


#3

Hey, mtf did you read the person’s second sentence?
“I used “hsl” and add the opacity value to it and it is still working good.”