CSS rgba() Function

❮ Previous Functions Next ❯

Example

.example1 {
  background: rgba(0, 255, 0, 0.6);
}

.example2 {
  background: rgba(0%, 100%, 0%, 0.6);
}




Meaning

The rgba() css function defines a given color in the sRGB color space according to its red, green, and blue components. An optional alpha component represents the color's transparency.

Note: The legacy rgba() syntax is an alias for rgb(), accepting the same parameters and behaving in the same way.

Version: CSS3




Standard Syntax

/* Syntax with space-separated values */
rgba(r g b / a)

/* Syntax with comma-separated values */
rgba(r, g, b, a)



Browser Support

The numbers in the table specify the first browser version that fully supports the property.




Status







Function Arguments

The following table describes the arguments of this function.

Argument Description
r Red. Specifies numbers or percentages, where the number 255 corresponds to 100%.
g Green. Specifies numbers or percentages, where the number 255 corresponds to 100%.
b Blue. Specifies numbers or percentages, where the number 255 corresponds to 100%.
alpha Alpha. Specifies a number between 0 and 1, or a percentage, where the number 1 corresponds to 100% (full opacity).
❮ Previous Functions Next ❯