Set the color value for opacity or rgba

Source: Internet
Author: User

The opacity declaration is used to set the transparency value of an element. (The transparency value is a decimal point between 0 and 1. 0.5 indicates 50% transparency ).

Opacity features that when opacity sets the transparency value of an element, the internal text and elements are also transparent.

. Demo {background-color: red; filter: alpha (opacity = 30); opacity: 0.3 ;}

Note: The transparent value of the label element whose class is demo is 30%, and the text transparency value in this code will also change to 30%.

 

Rgba is also used to set the color.

R: positive integer in red | percentage

G: positive integer in green | percentage

B: positive integer in Blue | percentage

A: transparency (value range: 0-1)

The color value set through rgba is only for the current element. The transparency value of the internal text and element has not changed.

. Demo {background-color: rgba (0.3, 0 )}

 

Rgba sets the color value for browser support:

 

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.