XHTML is still a very poor language and you have to try for many tricks in order to achieve simple results, as centering an object, and to obtain them on every browser. That’s my problem.
So, I have a image that is covering the entire page. It is not a background, because I want it to fit the screen and a background doesn’t do that. My image is positioned as absolute.
Now, what I want is a flash swf to be centered horizontally over the image. Sometimes it works, but only on non-IE browser (as always). Sometimes it doesn’t on any browser. The problem is that I just don’t know how to make the flasj object being centered over the image. It always appears at the top left part of the screen.
My code is something like this:
<body style="margin: 0px auto; text-align: center; width: 100%; height: 100%;">
<object type="application/x-shockwave-flash"
height="100" width="200"
style="position: absolute; float: top; margin: 10px auto; z-index: 1;">
...
...
</object>
<img src="image.jpg" height="100%" width="100%"
style="postion: absolute; left: 0px; top: 0px; z-index:-1;" />
</body>
The main problem is that I cannot see the flash center in IE (Impossible to Explore) browser. What do you think? Thanks!
First I highly recommend swfobject, the widely used standard for embedding flash into html.
http://code.google.com/p/swfobject/
If you’d like to keep going with the object tag, try wrapping it in a div and set your positioning properties on the div, not the object tag.