This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > Flash Site Design > May 2005 > How to center a swf within a DIV tag??





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author How to center a swf within a DIV tag??
Skatestick

2005-05-26, 7:29 pm

Hi, I want a swf file tonto a website with DIV tags but I want the swf to be
centered no matter what the resolution is. This is what I have:

<html>

<head>

<title>Televisie</title>

<style>
#example{
position:absolute;
top:20px;
left:20px; <-------- ??? Should that be diffirent or be left out?
width:800px;
height:600px;

}

</style>

</head>

<body>

<div align="center" id="example">

<embed src="example.swf" wmode="transparent" width="800" height="600">

</div>

</body>

Please help. Thanks

</html>

El Jay Kay

2005-05-29, 4:16 am

Hi -
So you really need this to be 20px from the top and left of the browser window?
If not, I'd avoid using absolute positioning, since it can be rather
problematic.
The quick answer is -
margin{
0 auto;}
Which leaves no margin at the top and bottom, then lets the browser det. the L
& R. This will center anything 90% of the time...

An alternative to absol. posit. would be to set the div's text-align:left; to
move any content to the left side. Be sure you've specified the width and
margins of the div, then you really shouldn't need to mess with the .swf's tags.
If needed, you can do -
#example object, #example embed{
styles go here;}

Good luck,
El

Sponsored Links


Copyright 2003 - 2008 forum4designers.com  Software forum  Computer Hardware reviews