How do I use CSS to place a flash object behind a div?

Discussion in 'CSS' started by Imozeb, May 17, 2010.

  1. #1
    I am trying to place a flash object (<object>) behind a div tag. How would I do this?

    I've been trying z-index:-1; on the object tag but it isn't working.

    Thanks.
     
    Imozeb, May 17, 2010 IP
  2. designmonkey

    designmonkey Peon

    Messages:
    70
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #2
    when setting z-index properties are you set the position too?
    it should be like this :
    .class{
    position:relative; /*position could be relative or absolute */
    z-index:10;
    }

    try wrap the flash object on a div ( let say div#flash ) and the other container as is sibling ( i.e div#content )
    let say you want to make the div#content placed above the div#flas try something like this :
    
    <style>
    #wrapper{
    position:relative;
    z-index:1;
    }
    #flash{
    position:absolute;
    width:300px;
    height:400px;
    z-index:5;
    }
    #content{
    position:absolute;
    width:200px;
    height:300px;
    z-index:10;
    top:50px;
    left:50px;
    
    /*to make things clearer*/
    border:2px solid #808080;
    
    }
    </style>
    
    <div id="wrapper">
    <div id="flash"><object etc goes here /></div>
    <div id="content" ><p>sample content </p></div>
    </div>
    
    Code (markup):
    hope this helps
     
    designmonkey, May 17, 2010 IP
  3. Imozeb

    Imozeb Peon

    Messages:
    666
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I got it! I had to put a param on the flash object that makes it transparent, which also lets z-index work on it.
     
    Imozeb, May 18, 2010 IP
  4. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #4
    wmode="transparent" uses a lot of cpu cycles. Unless your flash object is not rectangular, it is less cpu intensive to set wmode="opaque", which will also cause flash to not be a windowed object.

    Be kind to your visitors.

    cheers,

    gary
     
    kk5st, May 18, 2010 IP
    Imozeb likes this.
  5. Imozeb

    Imozeb Peon

    Messages:
    666
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Thanks for the advice.
     
    Imozeb, May 18, 2010 IP