Set the opacity or RGBA color, opacityrgba color

Source: Internet
Author: User

Set the opacity or RGBA color, opacityrgba color

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 transparent value of the text and element in the Code is also 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(255,0,0,0.3)}

Note: the transparency value of the label element in this Code class is 30%, and the text and element transparency values in the demo do not change.

 

RGBA sets the color value for browser support:

 


Css opacity inheritance issues, how do I not integrate parent-level background color transparency?

The opacity attribute is valid only for the elements of the application attribute. child elements (including child elements) are not inherited and the values are between 0 and 1 (0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1), 0 is completely transparent, and 1 is completely opaque. Opacity will make all the elements transparent, not just the background color. If you only need to make the background transparent, you can use rgba ():
Background: raba (x1, x2, x3, y );
The value of x1 x2 x3 is an integer between 0 and 25 5.
The value y is between 0 and 1 (0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1)

IE, you can use a filter, filter: alpha ()

Use the following code to test non-ie browsers:

The opacity.html file code is as follows:
<! Doctype html>
How to set the color of css to rgba?

What tools !?
Ediplus, UE, dreamwave .....
 

Related Article

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.