Css effects of the parent element of transparency (opacity) sub-elements

First, the child inherits the parent element will be an element of transparency :

  • Set the parent element opacity: 0.5, do not set the opacity child elements, sub-elements will be affected parent element opacity, there will be transparency 0.5.

Secondly, transparency child element of the parent element of transparency is based on the calculation of :

  • Parent elements disposed opacity: 0.5, even if the child elements opacity: 1, opacity child elements: 1 is the parent element of opacity: 0.5 on the basis of the set, and therefore opacity or 0.5 subelements.

Solution :

Using RGBA CSS3 properties (i.e. red + green + blue + alpha color),

for example, background-color: rgba (0,0,0,0.5)

but IE7 / 8 does not support this property, can be written as follows:

parent element div write the following:

background-Color: RGBA (0,0,0,0.5) Important;!

background-Color: # 000;

filter: the Alpha (Opacity = 50);

child div element plus positioning position: absolute / relative to .


That help small partners upper right corner a praise ~

Here Insert Picture Description

Fanger Wei code scanning my attention subscription number ~

I feel a small partner to help point a praise ~

Guess you like

Origin www.cnblogs.com/zheroXH/p/11690321.html