...

View Full Version : Making layer center : how?



fireblade
07-15-2007, 01:15 PM
hey masters! help me...

what is the way of making a layer center to the page..? vertical and horizontal?

sdcomputerz
07-16-2007, 01:48 AM
Just set:
left: 50%;
top: 50%;

Jutlander
07-16-2007, 02:48 AM
No, use a wrapper.



* {
margin: 0;
padding: 0;
}
#wrapper {
margin: 0 auto;
width: 600px;
border: 1px solid #000;
padding: 20px;
}


Then you wrap everything inside the wrapper:



<div id="wrapper">
[everything goes here]
</div>

jlhaslip
07-16-2007, 02:54 AM
Here is a link to a page which, if I recall correctly, came from a previous posting here. Full credits to whomever posted it originally. I merely snagged a copy. Do a View Source to get the code, but essentially, centre the div using absolute positioning and then apply negative margins equal to half of the height and width. Enjoy.

http://www.jlhaslip.trap17.com/samples/misc/positions/cssverticalcentereddiv.html

VIPStephan
07-16-2007, 03:27 AM
No, use a wrapper.



* {
margin: 0;
padding: 0;
}
#wrapper {
margin: 0 auto;
width: 600px;
border: 1px solid #000;
padding: 20px;
}


Then you wrap everything inside the wrapper:



<div id="wrapper">
[everything goes here]
</div>


Usually if somebody is speaking of a layer they mean an absolutely positioned div (since it’s kind of layered above the other elements) in which case this wouldn’t work as well.

fireblade
07-16-2007, 06:13 AM
thanx every body who helped me to get..



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum