Fonction CSS rgba()
Exemple
Définissez différentes couleurs RVB avec opacité (RVBA) :
#p1 {background-color:rgba(255,0,0,0.3);} /* red with opacity*/
#p2 {background-color:rgba(0,255,0,0.3);} /* green with opacity */
#p3 {background-color:rgba(0,0,255,0.3);} /* blue with opacity */
Définition et utilisation
La fonction rgba() définit les couleurs à l'aide du modèle rouge-vert-bleu-alpha (RGBA).
Les valeurs de couleur RGBA sont une extension des valeurs de couleur RGB avec un canal alpha - qui spécifie l'opacité de la couleur.
Version: | CSS3 |
---|
Prise en charge du navigateur
Les chiffres du tableau indiquent la première version du navigateur qui prend entièrement en charge la fonction.
Function | |||||
---|---|---|---|---|---|
rgba() | 1.0 | 9.0 | 3.0 | 3.1 | 10.0 |
Syntaxe CSS
rgba(red, green, blue, alpha)
Value | Description |
---|---|
red | Defines the intensity of red as an integer between 0 and 255, or as a percentage value between 0% and 100% |
green | Defines the intensity of green as an integer between 0 and 255, or as a percentage value between 0% and 100% |
blue | Defines the intensity of blue as an integer between 0 and 255, or as a percentage value between 0% and 100% |
alpha | Defines the opacity as a number between 0.0 (fully transparent) and 1.0 (fully opaque) |