CSS sets transparency and rgba color mode

Source: Internet
Author: User

I have previously written an article about CSS transparency, complaining that after CSS sets transparency for an element, the elements in it are also transparent. Recently I found that this is actually quite good.

Sometimes we want an opaque background text, such as an "Information warning box", but when we add the opacity attribute to this element, it was found that the background and everything in it were translucent, making it difficult to identify.

If you stick to opacity, you will find it difficult to use opacity to make the background translucent text opaque. So, like me, I think W3C's transparency settings really hurt.

In fact, we are wrong.

To make the background translucent text opaqueBackgroundSetRgbaForm! For example:

Background: rgba (0.5, 0 );

Instead, set the color to rgba if the text is translucent and the background does not matter!

If you need to maintain a transparency for all the child elements of this elementOpacityAttribute:

Opacity: 0.5;

We can think like this: if you want to keep a transparency for all elements in a region, but the opacity of CSS cannot inherit, how much will you feel! How many elements do you need To Set opacity?

Appendix 1:

So, I think the CSS transparency settings are quite good now, and I am in favor of it-but how can I hate ie again? Mom, does ie support the rgba color format!

Http://www.jo2.org/archives/291.htm.

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.