Can we refer to embed/objects inside CSS?

Discussion in 'CSS' started by wd_2k6, Jun 29, 2008.

  1. #1
    Hi, I was wondering lets say I have an embed object, something like a Youtube Video, if I wanted to give this a margin right of 500px would I have to shove it in side a DIV first, or is it possible to refer to it directly without the DIV inside the CSS?
     
    wd_2k6, Jun 29, 2008 IP
  2. Stomme poes

    Stomme poes Peon

    Messages:
    3,195
    Likes Received:
    136
    Best Answers:
    0
    Trophy Points:
    0
    #2
    object tags have some goofy properties... I think they're blocks... you can either

    object {
    margin-right: 500px;
    }

    or you can
    <object id="funkyflashfilm">
    and then

    #funkyflashfilm {
    margin-right: 500px;
    }

    either one. Things you might have trouble with are borders and overlapping... differs from browser to browser.
     
    Stomme poes, Jun 29, 2008 IP
  3. wd_2k6

    wd_2k6 Peon

    Messages:
    1,740
    Likes Received:
    54
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Hey Poes, thanks for the help it was an embed object so just embed { margin: blah; } basically. No probs with negative margins or floats, just the stupid border ah well i'll have to shove it on another element!! Although the border works in IE and not FF which is a first!

    Update I also could not add a background image inside CSS via this method e.g:

    embed { background: whatever; }

    I think this actually also works in IE but gets shoved behind the video as of course it's a background image,as I can see it before the video loads. but in FF it doesn't work, added padding to see but no image.

    So seems IE is more reliable than FF in this case..? Well maybe not reliable but has more options I guess!
     
    wd_2k6, Jun 30, 2008 IP
  4. Stomme poes

    Stomme poes Peon

    Messages:
    3,195
    Likes Received:
    136
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Since embed's not a valid tag, how well it works cross-browser is always a toss-up (unfortunately, object, which IS a valid tag, has poorer support!)

    If this is something like a Flash film and you want a background image, I'd go ahead and wrap it in a sanbagging div whose sole purpose is to hold the background image.

    If you're interested:
    http://www.alistapart.com/articles/flashsatay

    http://www.alistapart.com/articles/byebyeembed/

    The problem with Satay is the stupid "Click here to continue loading this page" crap in IE6... most people get around this using a Javascript loader like SWFObject, but beware, those with JS off will not get the Flash even if they DO have the Flash player installed.
     
    Stomme poes, Jul 1, 2008 IP