Discussion on inheritance issues of CSS transparency in IE and FF
Author:Eve Cole
Update Time:2009-06-10 17:05:49
When the parent container sets transparency, the child container will inherit the properties of the parent container. Faced with this problem, we don't know whether to call it a bug or a problem with how everyone understands transparency. Regardless of what the CSS standard thinks is the most reasonable, how to solve such a problem when we encounter a situation where we don’t want the subcontainer to be transparent.
Method one:
For IE, add in the subcontainer:
position:relative;
For firefox, etc., you can only use png.
background:url(images/boxBg.png);
/*The following is only recognized by IE*/
*background:#CCCCCC;
Method two:
A brief description is also a common method on the Internet.
Construct three containers. First, let the container that needs to be transparent and the opaque container maintain a sibling relationship.
Then, control the size through the parent container so that the two sibling containers maintain a seemingly parent-child arrangement through positioning.
The second method avoids the transparency inheritance problem, but does not solve the transparency inheritance problem.