Example of using RGBA to set transparency in CSS3

Source: Internet
Author: User

Description

RGBA (R,g,b,a)

Take value:

R: Red value. Positive integer | Percentage

G: Green value. Positive integer | Percentage

B: The blue value. Positive integer | Percentage

A:alpha transparency. Between values 0~1.

Here is the white with Rgba () set 50% transparency.

CSS code copy content to clipboard

p {

Color:rgba (255, 255, 255, 0.5);

}

RGBA is an extension of the RGB color model. This abbreviation represents the first letter of the red, green and blue primaries, and the alpha value represents the transparency/opacity of the color.

The format of the RGBA color notation is::

CSS code copy content to clipboard

RGBA (red, green, blue, alpha)

The first three values (red, green and blue) range from 0 to 255 integers or percentages between 0% and 100%. These values describe the amount of red, green, and blue three primary colors in the desired color.

If you want to set the pure red, then set the red parameter full, that is, 255, green, blue set 0.

CSS code copy content to clipboard

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

Results:

You can also use percentages:

CSS code copy content to clipboard

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

Results:

The fourth value, alpha, is the transparency/opacity of the color, which ranges from 0.0 to 1.0

The following example is a yellow setting of 50% transparency:

CSS code copy content to clipboard

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

Results:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.