is it possible to?

we have:

<div> <object> ...swf...</object> </div> 

Is it possible to align the flash drive inside the diva?

    3 answers 3

    Have a diva put:

     margin: 0 auto; 

    UPD: if vertically yet ..

    • Option times.

    If you know the width and height, then you can like this. Object style:

     left: 50%; top: 50%; margin-left: -(width/2)px; margin-top: -(height/2)px; position: absolute; 

    Parent diva style:

     position: relative; 
    • Option 2.

    You can use js to get the dimensions, indent. If js is off, it will be. But otherwise everything will be nya.

    • Option 3.

    Parent block style:

     display: table-cell; vertical-align: middle; text-align: center; 

    But this is not very cross-browser. Perhaps for reliability (and for older browsers), you need another external div with display: table;

    • is it horizontally the same, and will all browsers work? and what is vertical? - Jenkamen
    • Either it wasn’t right about the vertical, or I didn’t notice, that's why I answered it =) I added upd. - Alexey Sonkin
    • flash drive sizes can be any - Jenkamen
    • Well, now I'll think of another option =) - Alexey Sonkin

    Maybe this will help

     <style> .object-wrapper {position: relative; left: XXpx; right: XXpx; top: XXpx;} </style><div class="object-wrapper"> ...swf... </div> 
    • What is XXpx? The size of the flash drive is unknown initially. - Jenkamen

    If the height of the flash drive is known, then the correct paddings should be put down vertically. If unknown, then

     <table> <tr> <td valign="middle" align="center">...</td> </tr> </table> 

    to help you.

    • if the height is unknown, how to embed it in the <object>? because there you need to specify the width and height - Jenkamen
    • The height can be variable or given as a percentage. - ling