Re: How to center a layer

message from GregSW18 on 18 Jul 2004
Hi Murray,

Sorry to bother you again with this issue - but i'd really like to learn how
to do this centered layer or table thing.

What I want to achieve is the centered 'window' as on the Cartier site.

http://www.cartier.com/us/index.html

When you reduce the browser window - the rectangle adjusts to stay centered -
both HORIZONTALLY and VERTICALLY.

Is it done with layers? I hope so - because nested tables are a pain.

Thanks,

- Greg
 
Thierry Koblentz replied to GregSW18 on 18 Jul 2004
I'm not Murray but I'll try to help you.

<body bgcolor="#3D0101" leftmargin="0" topmargin="0" rightmargin="0"
bottommargin="0" marginwidth="0" marginheight="0"><CENTER>
<table height=95% cellpadding=0 cellspacing=0 border=0><TR><TD><table
cellpadding=0 cellspacing=0 border=0><TR><TD valign=bottom><img
src="html/gif/copyrights.gif" alt="" width="8" height="76"
border="0"><br><img src="html/gif/pix.gif" alt="" width="1" height="7"
border="0"></TD><TD align=center><OBJECT
classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.ca
b#version=5,0,0,0" WIDTH=779 HEIGHT=421><PARAM NAME=movie VALUE="index.swf">
<PARAM NAME=quality VALUE=high> <PARAM NAME=bgcolor VALUE=#3D0101> <EMBED
src="index.swf" quality=high bgcolor=#3D0101 WIDTH=779 HEIGHT=421
TYPE="application/x-shockwave-flash"
PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_
Version=ShockwaveFlash"></EMBED></OBJECT></TD></TR></TABLE></TD></TR></TABLE
</BODY>

Not very clean BTW.

If you don't care about using frames go to www.ProjectSeven.com and look for
something called "letterbox" frameset

HTH,
Thierry

"GregSW18" <webforumsuser@macromedia.com> wrote in message
news:cddoet$lgl$1@forums.macromedia.com...
 
Murray *TMM* replied to GregSW18 on 18 Jul 2004
<frameset rows="100%,*" framespacing="0" frameborder="0">
<frame name="site" src="main.html" frameborder="0" scrolling="No" noresize
marginwidth="0" marginheight="0">
<frame name="blank" src="blank.html" frameborder="0" scrolling="No" noresize
marginwidth="0" marginheight="0">
</frameset>

Ewww.
 
Thierry Koblentz replied to Murray *TMM* on 18 Jul 2004
That's not gonna do much ;)

Thierry

"Murray *TMM*" <forums@HAHAgreat-web-sights.com> wrote in message
news:cddqj3$nb3$1@forums.macromedia.com...
 
Thierry Koblentz replied to Thierry Koblentz on 18 Jul 2004
I've done that already. Can't you see my post about the letterbox frameset?

Thierry

"GregSW18" <webforumsuser@macromedia.com> wrote in message
news:cddtoj$pr9$1@forums.macromedia.com...
 
Murray *TMM* replied to Thierry Koblentz on 19 Jul 2004
It's the code from the linked page posted originally. It's not what I
proposed.

The OP was saying he hoped that the page was centering layers. I posted the
page's frameset code.
 
Thierry Koblentz replied to Murray *TMM* on 19 Jul 2004
Hi Murray,
That page's frameset code doesn't center anything; it just creates 2 frames,
one being an "invisible blank".
That's why I replyed to your post, I didn't want the poster to try that code
and then turn in circles wondering why he couldn't make it work ;)

Thierry

"Murray *TMM*" <forums@HAHAgreat-web-sights.com> wrote in message
news:cdgcjg$770$1@forums.macromedia.com...
 
GregSW18 replied to Murray *TMM* on 19 Jul 2004
I think I've solved it! All by my untechnical self!

Create a layer. Use css to position it 50% from the left, 50% from the top.

Nest a 2nd layer inside it.

I want my 'window' to be 750 wide and 440 high.

So I position this 2nd layer -375 from the 1st layer's left edge. And -220
from the 1st layer's top edge.

I seems to work a treat. It's perfectly positioned in the middle of the page.
And the 1st layer's relative positioning ensures that when I adjust the browser
window - the 2nd layer stays horizontally and vertically centered.

Thanks for all your help.

Please let me know if you can see any potential flaws in my solution.

- Greg
 
Murray *TMM* replied to GregSW18 on 19 Jul 2004
I see a flaw.

Here's the right way to do it.

(inline styles used for clarity)

<div id="wrapper" style="width:760px; top:0; margin:0 auto;
position:relative;">
<div id="layer1" style="width:200px; top: 25px; left:140px;
position:absolute;">blah</div>
<div id="layer2" style="width:180px; top: 136px; left:23px;
position:absolute;">blah</div>
</div>

Try that - an outer relatively positioned division with a width and auto
left and right margins. All interior AP divisions will be centered, yet
retain the
same relative positioning.
 

Archived message: Re: How to center a layer (Macromedia Dreamweaver)