Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / Flash / Flash Site Design / September 2007



Tip: Looking for answers? Try searching our database.

absolute center SWF on HTML

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Rylz - 14 Sep 2007 17:59 GMT
I want to have my SWF be centered on the host HTML page both horizontally and
vertically.  I've got it to center horizontal, but can't get it vertically.  
Below is the tag I use in a CSS to try and center.  It will center horizontal,
like I said, but that's it.

margin-left: auto;
    width:800px;
    height:400px;
    margin-right:auto;
    margin-top:auto;
    margin-bottom:auto;
    height:100%;
    clear:left;
Rob Dillon - 14 Sep 2007 20:03 GMT
Use something like this:

#fullFloater {
    position:absolute;
    top:50%;
    left:50%;
    right:50%;
    bottom:50%;
    margin-top: -300;
    margin-left: -450;
    }

set the margin-top value to be half the height of your .swf and the
margin-left to be half the width of your .swf, each with a negative value.

Signature

Rob

___________
Rob Dillon
Adobe Community Expert
http://www.ddg-designs.com
412.243.9119

Rylz - 14 Sep 2007 20:14 GMT
That didn't work.  It puts the SWF to the far bottom-right corner of the page
and I have to scroll to see it.  I took your code exactly and changed the
margins appropriately.  I have an 800w X 400h SWF, so I made margin-top "-200"
and margin-left "-400".
Rylz - 14 Sep 2007 20:16 GMT
Ah, got it.  I had to put "px" after the margin values.  I don't know why, other than perhaps "px" isn't the default value.  Anyway, it works now.  Thanks!
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.