# Centering SWF in Browser

**URL:** https://forum.kirupa.com/t/centering-swf-in-browser/56881
**Category:** flash
**Created:** [July 8, 2004, 3:02pm UTC](https://forum.kirupa.com/t/centering-swf-in-browser/56881 "2004-07-08T15:02:39Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![wyclef](https://avatars.discourse-cdn.com/v4/letter/w/65b543/32.png) [@wyclef](https://forum.kirupa.com/u/wyclef)
#### Post date: [July 8, 2004, 3:02pm UTC](https://forum.kirupa.com/t/centering-swf-in-browser/56881/1 "2004-07-08T15:02:39Z")

</div>

Hello,

I’m trying to center an swf in a browser without using table width and height 100% and the most promising way i’ve found so far is to set

Stage.scaleMode = “noscale”;

in the first frame and then set the width and height of the object tag in the html to 100%. However, i’m having trouble getting this to work with the doctype in some newer browsers. What am I doing wrong?

\<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”  
“[http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd](http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd)”\>  
\<html xmlns=“[http://www.w3.org/1999/xhtml](http://www.w3.org/1999/xhtml)”\>  
\<head\>  
\<title\>Test\</title\>  
\<meta http-equiv=“Content-Type” content=“text/html; charset=iso-8859-1” /\>  
\<meta http-equiv=“Content-Language” content=“en-us” /\>

\</head\>  
\<body bgcolor="#FFFFFF"\>  
\<object type=“application/x-shockwave-flash” data=“test.swf” width=“100%” height=“100%”\>  
\<param name=“MOVIE” value=“test.swf” /\>  
\<param name=“PLAY” value=“true” /\>  
\</object\>  
\</body\>  
\</html\>

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 8, 2004, 7:12pm UTC](https://forum.kirupa.com/t/centering-swf-in-browser/56881/2 "2004-07-08T19:12:56Z")

</div>

i added this to the object tag and it seems to work now in the newer browsers…

style=“position: absolute; top: 0px; bottom: 0px; right: 0px; left: 0px; z-index: 1”

does anyone have any idea on how i can get this to work now in older browsers like netscape 4.x?

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 8, 2004, 7:49pm UTC](https://forum.kirupa.com/t/centering-swf-in-browser/56881/3 "2004-07-08T19:49:03Z")

</div>

The way I’ve been able to get a single object to be centered vertically and horizontally in a browser is by the use of an HTML table. For example:

\<html\>  
\<head\>  
\<title\>Place Page Title Here\</title\>  
\<body\>  
\<table align=‘center’ border=‘0’ cellpadding=‘0’ cellspacing=‘0’ width=‘100%’ height=‘100%’\>  
\<tr\>  
\<td align=‘center’ valign=‘middle’\>  
Place Object Here  
\</td\>  
\</tr\>  
\</table\>  
\</body\>  
\</html\>

Hope this works for you! Good luck!

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 8, 2004, 7:51pm UTC](https://forum.kirupa.com/t/centering-swf-in-browser/56881/4 "2004-07-08T19:51:09Z")

</div>

> **[HTML Editor, Website & Web Design Software](https://www.coffeecup.com/)**
>
> Leader in Responsive Web Design Tools and HTML Software. Try our HTML Editor, innovative Responsive Email Designer or Responsive Prototyping Software today.
