Detailed RGBA compatibility processing method

Source: Internet
Author: User
Depending on the Caniuse (http://caniuse.com/#search =rgba), RGBA compatibility is IE9 and above browsers.

Instance code:

<!doctype html>

Chrome browser Effects:

IE8 Browser effect (no background):

RGBA Compatibility Processing:

. parent {                width:400px;                height:400px;                margin:100px;                font-size:20px;                Color: #FF0000;                border:1px solid red;                Background:rgba (0, 0, 0, 0.5);                /* Next Key setting *                /Filter:progid:DXImageTransform.Microsoft.gradient (startcolorstr= #7f000000, endcolorstr=# 7f000000);            }

Setting the Filter property to be performed when the transparency of the previous line does not work, Filter:progid:DXImageTransform.Microsoft.gradient is used for gradients, but this place does not require gradients, So two colors are set to the same color.

This color "#7f000000" is made up of two parts.

The first part is the 7f behind the # number . is the Iefilter value of the RGBA transparency 0.5. From 0.1 to 0.9 each number corresponds to a iefilter value. The corresponding relationship is as follows:

That is: The value obtained by the alpha*255 is converted to 16 binary.

The second part is the six-bit color value after 7f , which is the same as the value in the RGB function, such as RGB (255,255,255) corresponds to #ffffff.

Summary: This completes IE8 and the following IE browser RGBA compatibility processing.

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.