How to make flash content stay in middle of browser

Caporegime
Joined
13 May 2003
Posts
34,561
Location
Warwickshire
Hi all

I'm making my first flash website for my brother-in-law's wedding, and I'm learning fine, but the simple things always seem to be the hardest!

How do I make the flash movie content stay centre justified in the browser no matter what? I have given it a "middle" alignment in Dreamweaver

Code:
id="index" align="middle"

but it still stays hugged to the left side of the screen.

Any ideas?
 
Last edited:
If it's the only thing on the page, you could put in your stylesheet:

Code:
body { text-align:center; }

and then if you wrap your flash in say

Code:
<div id="flash"></div>

and in your stylesheet put

Code:
div#flash { margin:0 auto;width:widthofyourflashmovieinpx; }

Should do the trick
 
Thanks very much, but before I saw your solution, I tried inserting a table in the html in Dreamweaver and aligning the table centre, which worked.

Here's phase one if you're interested

http://www.robertandcatherine.site40.net

Going to make an entire flash site with linkage to other pages that the subtitles refer to (haven't figured that out yet!) and hopefully a database showing the people getting married who has bought what from their wedding list, since they don't want to use a department store. That last part should be interesting since I haven't even read a line of PHP yet!
 
Hi Robbie

Tables aren't really considered good practice for layouts nowadays, you should definitely look at using divs and stylesheets.
 
Tables are for displaying tabular content - they are not designed to be used for design & layout.

CSS is for layout. You want to be keeping content and style separate (and it also allows you to use a single stylesheet to change the look/feel of multiple pages with the minimum effort)
 
If it's the only thing on the page, you could put in your stylesheet:

Code:
body { text-align:center; }

and then if you wrap your flash in say

Code:
<div id="flash"></div>

and in your stylesheet put

Code:
div#flash { margin:0 auto;width:widthofyourflashmovieinpx; }

Should do the trick


Hi, I've tried this and it works perfectly! Thanks!

However can I ask what you mean by "If it's the only thing on the page"? Does that mean that if I add extra html outside the Flash movie I need to define that block and style it also?
 
Hi Robbie

Yeah it just means that because you set

Code:
body { text-align:center; }

everything on the page will center, so if you wanted other stuff aligned differently, you'd need to set say

Code:
div#other_content { margin:0 auto;width:100%;text-align:left; }

to overwrite the body's centering.
 
Back
Top Bottom