# "dead center" with swfobject.js and CSS

**URL:** https://forum.kirupa.com/t/dead-center-with-swfobject-js-and-css/228075
**Category:** web dev
**Created:** [June 5, 2007, 6:09am UTC](https://forum.kirupa.com/t/dead-center-with-swfobject-js-and-css/228075 "2007-06-05T06:09:29Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![rf1017](https://avatars.discourse-cdn.com/v4/letter/r/e0b2c6/32.png) [@rf1017](https://forum.kirupa.com/u/rf1017)
#### Post date: [June 5, 2007, 6:09am UTC](https://forum.kirupa.com/t/dead-center-with-swfobject-js-and-css/228075/1 "2007-06-05T06:09:29Z")

</div>

hello, I’m trying to center some flash content vertically and horizontally using CSS. I’m using the swfobject.js to embed the Flash content.

I found a great tutorial on how to center content /w CSS: [http://www.wpdfd.com/editorial/thebox/deadcentre4.html](http://www.wpdfd.com/editorial/thebox/deadcentre4.html)

It’s working in Firefox, but not Safari for me for some reason (I don’t have IE on this machine, but needs to work with it of course too)

So using that I came up with this:

```auto
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>RisingStar</title>
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="-1">
<script type="text/javascript" src="swfobject.js"></script>
<style type="text/css" media="all">@import url(efc.css);</style>
</head>
<body bgcolor="#ffffff" leftmargin="0" topmargin="0" marginheight="0" marginwidth="0">
<div id="horizon">
<div id="flashcontent"><br><br><font color="#000000">This site requires Flash Player 7 or greater to function correctly.<br>Please download <a href="http://www.macromedia.com/go/getflash" target="_blank"><font color="#ffffff"><u>HERE</u></font></a></font>
</div> </div>

<script type="text/javascript">
   var so = new SWFObject("efc2.swf", "Eleven Fingered Charlie", "825", "475 ", "8", "#ffffff");  
   so.write("flashcontent");
</script>

</script>
</body>
</html>

```

here’s the efc.css file:

```auto
#horizon        
    {
    color: white;
    background-color: #ffffff;
    text-align: center;
    position: absolute;
    top: 50%;
    left: 0px;
    width: 100%;
    height: 1px;
    overflow: visible;
    visibility: visible;
    display: block
    }

#flashcontent    
    {
    font-family: Verdana, Geneva, Arial, sans-serif;
    background-color: #f00;
    margin-left: -410px;
    position: absolute;
    top: -237px;
    left: 50%;
    width: 825px;
    height: 475px;
    visibility: visible
    }

```

Can anyone tell me what I’m doing wrong?
