In this article, we will learn how to create a white rgba in HTML with the help of the rgba() function.
Create a White rgba in HTML
rgba() specifies a sequence of values that can change the color of an element such as its background color, image color, box color, and so on. Moreover, it can also be utilized to create a white color using a specific set of rgba values.
Syntax
In CSS, you can use the following syntax to create a color with rgba values:
Here, color intensity is defined by each parameter (red, green, blue, alpha). Using this formula, we can display white rgba by setting all color parameters to “255”, and alpha to “0”. In general, alpha ranges start from 0.0 and end at 1.0, where 0.0 indicates complete transparency and 1.0 denotes no transparency at all.
To clarify the above-mentioned points, let’s move to the example.
Example: Creating White rgba in HTML Using rgba() Function
To create a white rgba, first we will add a container using the “<div>” tag in our HTML file:
In the next step, we will assign values to the width and height as “50%” and “200px”. Then, add any background color of the div using the rgba() function in CSS. After that, set the border color “solid black” to create a difference between the whole web page and the div:
width:50%;
height:200px;
background:rgba(23, 1, 36, 0.7);
}
.RGBA{
border:5px solid black;
}
Currently, our web page look like this:
Now, we will set white rgba as the background of our container by passing “255, 255, 255, 0” as an argument to the rgba() function:
width:50%;
height:200px;
background:rgba(255, 255, 255, 0);
}
.RGBA{
border:5px solid black;
}
After implementing the given code, check out its results:
Note: You can also create white rgba color using the rgba() function by setting the value of red, green blue, and alpha to “0”.
Conclusion
To create a white color, pass the first three parameters of the rgba() function as “255” and the alpha parameter as “0”. You can also generate white rgba by passing the values of all parameters as “0”. Moreover, the rgba() function allows us to set the different colors in HTML elements. This article demonstrated the method of creating white rgba in HTML.