CSS hsla() Funzione
❮ Riferimento alle funzioni CSS
Esempio
Definisci diversi colori HSL con opacità:
#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 */
Definizione e utilizzo
La funzione hsla() definisce i colori utilizzando il modello Hue-saturation-lightness-alpha (HSLA).
I valori di colore HSLA sono un'estensione dei valori di colore HSL con un canale alfa, che specifica l'opacità del colore.
Versione: | CSS3 |
---|
Supporto browser
I numeri nella tabella specificano la prima versione del browser che supporta completamente la funzione.
Function | |||||
---|---|---|---|---|---|
hsla() | 1.0 | 9.0 | 3.0 | 3.1 | 10.0 |
Sintassi 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) |
❮ Riferimento alle funzioni CSS