PDA

View Full Version : Absolute middle.


veteran
06-01-2007, 10:28 PM
I have a flash site, first attempt.
I want the flash part of the site to be in the middle of the browser, when a viewer resizes the content stays in the center of the browser.
Sample http://www.woodbine.com

They did it using CSS. Is there another way? My CSS is weak.
If you can offer a simple explanation of their CSS code regarding positioning, I will attempt it.

I assume it can be done with Dreamweavers control panel for CSS, am I mistaken? If it can, I think I can follow somebody's directions.
Is there a thread on this already maybe? I will check.

Thank you.

veteran
06-02-2007, 12:35 AM
...from my previous posting,

I got it to work sort of.
I used .flash instead of #flash (Whats the difference?) ...and div id "" versus class ""?

and the margin code, whats that about? I see it dictates(I think) where to position the content. I changed the parameters and saw the position change.

Do i have to play with those number til I find what I want, or is there a science? Does the margin-left, margin-top position the top left corner?

I will keep working on it...
Thanks

veteran
06-02-2007, 12:46 AM
using the margin left, top settigs.

Thinking out loud, it appears that absolute is the center of the page. So when using margin settings, its relative to those coordinates, explaining the use of negative coordinates sometimes to center.
The math I used to position was to divide the flash content in half and use that number relative to the aboslute center.

position:absolute;
top:50%;
left:50%;
margin-left:-270px;
margin-top:-180px;

What does
top:50%;
left:50%;
do?

domedia
06-05-2007, 02:57 PM
That puts the layer absolutely 50% from the top left corner of the website (the full width/height being 100%), the negative margins is then probably half the height width of your layer to make the math work.