[HTML] : centered layers

NerdUprising

[ Method ]
Joined
23 May 2003
Messages
736
I'm writing a page in which there are two layers over top of one another (a swf in one, an image behind it in another). I would like to have the layers be centered in any resolution, rather than just writing it for basic 1024x768, but with my not-so-great knowledge of HTML, I dont know how to go about it. I searched through HTML forums/tutorial sites, and couldn't find anything, possibly because I'm blind.

Any pointing in the right direction/suggestions/directions would be greatly appreciated, thanks.
 
you want to create a css definition that contains:

margin-left: auto
margin-right: auto

and apply it to the layers you want centred
 
you can cheat and do it the old fasioned, non standards way with <center>stuff</center>
 
I played with an insane amount of things to try and get this to work, and I finally reached a point of success with "style="margin-left: auto; margin-right: auto;" in the layer's tag. This, for one reason or another, wouldn't work with two or more layers... they would be centered, but wouldn't be over top of one another anymore. No big deal, I just made the shadow part of the swf, and placed it in one centered layer - less chance of there being a code mishap when the page is rendered that way anyway.

Thank you for the help, sirs.
 
keep the margin-left and margin-right for each of them they will keep it centered if you set a width for each section as well
to make the layers overlay you will need to set the z-index. put a z-index of 0 for the bottom layer and a z-index of 1 or greater for the top layer, that should work
 
yeah, it was odd like that - I had the z-index' set for each (0 and 1), and the layering had worked before I put the margin-left/right in the tag. After the change, the two layers would show up in the page one after the other, the second layer using the "margin-top=" or "top:" pixel number as the space between the first layer and the second, rather than from the top of the page. Odd, yes?
 

Members online

No members online now.

Latest profile posts

Also Hi EP and people. I found this place again while looking through a oooollllllldddd backup. I have filled over 10TB and was looking at my collection of antiques. Any bids on the 500Mhz Win 95 fix?
Any of the SP crew still out there?
Xie wrote on Electronic Punk's profile.
Impressed you have kept this alive this long EP! So many sites have come and gone. :(

Just did some crude math and I apparently joined almost 18yrs ago, how is that possible???
hello peeps... is been some time since i last came here.
Electronic Punk wrote on Sazar's profile.
Rest in peace my friend, been trying to find you and finally did in the worst way imaginable.

Forum statistics

Threads
62,015
Messages
673,494
Members
5,621
Latest member
naeemsafi
Back