What does the "a" in rgba mean? CSS RGBA Color Guide

What does the "a" in rgba mean? CSS RGBA Color Guide

RGBA is a CSS color that can set color value and transparency

Below is the use of rgba() to set the white color to 50% transparency.

p {
color: rgba(255, 255, 255, 0.5);
}

RGBA is an extension of the RGB color model. This acronym stands for the initials of the three primary colors red, green and blue, and the Alpha value represents the transparency/opacity of the color.

RGBA Syntax

The format of RGBA color representation is:

rgba(red, green, blue, alpha)

The first three values ​​(red, green, and blue) range from 0 to 255 as integers or from 0% to 100% as percentages. These values ​​describe the amounts of the three primary colors red, green and blue that are present in the intended color.
If you want to set pure red, set the red parameter to 255, and set green and blue to 0.

background-color: rgba(255, 0, 0, 1);

result:

Percentages can also be used:

background-color: rgba(100%, 0%, 0%, 1);

result:

The fourth value, alpha, specifies the transparency/opacity of the color and ranges from 0.0 to 1.0.

The following example sets the yellow color to 50% transparency:

color: rgba(255, 242, 0, 0.5);

CSS translucency is compatible with Firefox, IE, and Chrome, and the current browser versions are relatively high. You can use it in your project with confidence.

<<:  3D tunnel effect implemented by CSS3

>>: 

Recommend

Detailed example of jQuery's chain programming style

The implementation principle of chain programming...

How to understand the difference between computed and watch in Vue

Table of contents Overview computed watch monitor...

JS implementation of carousel carousel case

This article example shares the specific code of ...

mysql5.7.19 zip detailed installation process and configuration

MySQL v5.7.19 official version (32/64 bit install...

Gojs implements ant line animation effect

Table of contents 1. Gojs Implementation 1. Drawi...

WeChat applet implements simple chat room

This article shares the specific code of the WeCh...

A brief discussion on MySql views, triggers and stored procedures

view What is a view? What is the role of a view? ...

How to make if judgment in js as smooth as silk

Table of contents Preface Code Implementation Ide...

Vue implements countdown between specified dates

This article example shares the specific code of ...

Vue installation and use

Table of contents 1. Vue installation Method 1: C...

Example code for realizing charging effect of B station with css+svg

difficulty Two mask creation of svg graphics Firs...

Implementation of Nginx domain name forwarding https access

A word in advance: Suddenly I received a task to ...

How to draw the timeline with vue+canvas

This article example shares the specific code of ...