CSS hsla() 함수
예시
불투명도로 다양한 HSL 색상 정의:
#p1 {background-color:hsla(120,100%,50%,0.3);} /* green */
#p2 {background-color:hsla(120,100%,75%,0.3);} /* light green */
#p3 {background-color:hsla(120,100%,25%,0.3);} /* dark green */
#p4 {background-color:hsla(120,60%,70%,0.3);} /* pastel green */
정의 및 사용
hsla() 함수는 Hue-saturation-lightness-alpha 모델(HSLA)을 사용하여 색상을 정의합니다.
HSLA 색상 값은 색상의 불투명도를 지정하는 알파 채널이 있는 HSL 색상 값의 확장입니다.
버전: | CSS3 |
---|
브라우저 지원
표의 숫자는 기능을 완전히 지원하는 첫 번째 브라우저 버전을 지정합니다.
Function | |||||
---|---|---|---|---|---|
hsla() | 1.0 | 9.0 | 3.0 | 3.1 | 10.0 |
CSS 구문
hsla(hue, saturation, lightness, alpha)
Value | Description |
---|---|
hue | Defines a degree on the color circle (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 |
alpha | Defines the opacity as a number between 0.0 (fully transparent) and 1.0 (fully opaque) |