Results 1 to 2 of 2

Thread: Inherited Opacity problem in FF & Chrome

  1. #1
    Join Date
    Oct 2009
    Location
    UK
    Posts
    36

    Inherited Opacity problem in FF & Chrome

    Hi guys, i thought i had published this post yesterday but i can't find it, so i apologise if it's actually somewhere out there in the ether.

    So, the problem i'm experiencing is to do with nested divs and the opacity setting in CSS.

    If i set the parent div to have 0.5 then the child div inherits it, that's fine if that is the desired affect i'm after but i'm not...

    So i explicitly declare the child div to have opacity 1.0; but this has no affect.

    Oh and the strange thing is that in IE with the filter: alpha(opacity) setting in the CSS it works perfectly...

    It seems the only way i can get around this is by not nesting the divs, but this ruins my layout.

    Here are a couple code snippets.

    HTML:
    Code:
    <body>
    <div id="wrapper">
        <div id="animContainer">
            <div id="sun">
                <div id="clouds1">
                    <div id="clouds2">
                        <div id="mountains">
                            <div id="robot">
                                <div id="robotHead"></div>
                            </div>
                        </div>
                    </div>
                </div> 
            </div> 
            <div id="ground"></div>
        </div>
        
        <div id="footer"></div>    
    </div>
    
    </body>
    CSS:
    Code:
    #clouds1
    {
        position:relative;
        background-image:url(../images/clouds1.png);
        background-repeat:repeat-x;
        height:215px;
        /*top:-150px;*/
        margin:0px;
        padding:0px;
        filter: alpha(opacity=70);
        opacity:0.5;   
    }
    
    #clouds2
    {
        position:relative;
        background-image:url(../images/clouds2.png);
        background-repeat:repeat-x;
        height:150px;
        /*top:-365px;*/
        margin:0px;
        padding:0px;
        filter: alpha(opacity=50);
        opacity:0.5; 
    }
    
    #mountains
    {
        position:relative;
        background-image:url(../images/mountain.png);
        height:220px;
        bottom:-410px;
        filter: alpha(opacity=100);
        -moz-opacity:1; 
    }
    I hope someone can help as this is driving me insane.

    Thanks in advance.
    Sol

  2. #2
    Join Date
    Oct 2009
    Location
    UK
    Posts
    36
    Sorry i found my old post.

    For anyone looking for an answer to this please go here:
    http://www.webdevforums.com/showthread.php?t=35997

    Sol

Similar Threads

  1. problem with google chrome
    By MagicMan in forum Web Design, HTML Reference and CSS
    Replies: 1
    Last Post: 04 Jul 2009, 01:52 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •