I encountered a problem today. I want to set a translucent white Div on a page. This does not seem to be a problem. You only need to set the following attributes for this Div:
background: rgba(255,255,255,.1);
But it must be compatible with IE8. This is a little painful. IE8 does not support the rgba () function. Next we will summarize the meaning of the rgba () function.
The meaning of rgba. R represents red, g Represents green, B Represents blue, and red, green and blue represent three primary colors. All colors can be combined by these three colors. A Indicates transparency. For example, rgba (255,255,255, 0.1) is white with a transparency of 0.1. Supports rgba in modern browsers. However, IE8 and other antique Browsers Do not support rgba. IE8 can only barely support the RGB () function (that is, with transparency removed, it can only represent colors ).
Therefore, in IE8, it will be costly to set translucent. The CSS code is as follows:
<span style="white-space:pre"></span>background: rgba(255,255,255,.1); filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#19ffffff,endColorstr=#19ffffff);
The second sentence means that the statement is executed when the transparency of a row does not work. The meaning of this sentence is originally used for gradient. However, no gradient is required in this area. So both colors are set to the same color.
Note that the color "# 19ffffff" is composed of two parts..
The first part is #19. Is the iefilter value of rgba transparency 0.1. Each number from 0.1 to 0.9 corresponds to an iefilter value. The relationship is as follows:
The second part is the six digits after the 19th digit.. This is a hexadecimal color value. The value must be the same as that in the RGB function. For example, the # ffffff; corresponding to RGB (255,255,255) is white.
By now, rgba is compatible with IE8.
Compatible with IE8 rgba () Usage