Page 1 of 2
					
				Aligning to center while still using DIV tags
				Posted: Sun Feb 14, 2010 8:00 pm
				by Zerk
				I want the game to be aligned to center, but I still want to be using position:absolute with div tags.
Right now everything is on the left.  If I use different positioning, it will only be aligned to center with my resolution.  How can I align to center with all resolutions?
This is what my site looks like right now: 
http://void.webege.com/ (uploaded it so you can look at it 

)
(Please do not register, it hasn't been updated in a long time.)
 
			
					
				Re: Aligning to center while still using DIV tags
				Posted: Sun Feb 14, 2010 8:01 pm
				by hallsofvallhalla
				make a div called wrapper and make the margins auto, put your entire site within this wrapper.
			 
			
					
				Re: Aligning to center while still using DIV tags
				Posted: Sun Feb 14, 2010 8:02 pm
				by Zerk
				hallsofvallhalla wrote:make a div called wrapper and make the margins auto, put your entire site within this wrapper.
make the margins auto?  
use:
margin:auto;
in the style sheet?  Never heard of it before, lol
EDIT: hmm...I tried it and it leaves it all on the left.  I added "border: 2px solid purple" to see if it surrounds the content and it doesn't.  It starts and ends at the top of the page.  I can't figure out how to get it to surround the whole page.
EDIT...again...: kept searching other places and found this:
Code: Select all
left: 50%;
width:800px;
margin-left:-400px;
It works 

  Thanks for your help, though.   

 and thanks for the video tutorials
 
			
					
				Re: Aligning to center while still using DIV tags
				Posted: Sun Feb 14, 2010 9:19 pm
				by Torniquet
				Code: Select all
<body>
  <div style="margin-left:auto; margin-right:auto;">
    content here
  </div>
</body>
that should work without any problems.
 
			
					
				Re: Aligning to center while still using DIV tags
				Posted: Mon Feb 15, 2010 4:08 am
				by Zerk
				Torniquet wrote:Code: Select all
<body>
  <div style="margin-left:auto; margin-right:auto;">
    content here
  </div>
</body>
that should work without any problems.
 
nope..
 
			
					
				Re: Aligning to center while still using DIV tags
				Posted: Mon Feb 15, 2010 4:46 am
				by Jackolantern
				Did you get it fixed since this post? When I look at the page you linked above, it appears to be centered properly.
			 
			
					
				Re: Aligning to center while still using DIV tags
				Posted: Mon Feb 15, 2010 2:42 pm
				by hallsofvallhalla
				looks liek he found an alternative but I would recommend trying it in all browsers and under a few different screen resolutions to make sure it always centers..
Nice job on solving the problem.
			 
			
					
				Re: Aligning to center while still using DIV tags
				Posted: Tue Feb 16, 2010 1:12 am
				by Zerk
				It seems to be working in all browsers in any resolution above 1024x800 (or whatever that middle resolution is).
Under that is centered, but there is unneeded margins on both sides so you have to scroll sideways a bit...hmm
			 
			
					
				Re: Aligning to center while still using DIV tags
				Posted: Tue Feb 16, 2010 1:25 am
				by Jackolantern
				Zerk wrote:It seems to be working in all browsers in any resolution above 1024x800 (or whatever that middle resolution is).
Under that is centered, but there is unneeded margins on both sides so you have to scroll sideways a bit...hmm
Hmmm...that is definitely a problem in today's world of various devices connecting to the web. Many platforms are using well under that resolution. Maybe it wasn't working before because of some clashing style in the page.
 
			
					
				Re: Aligning to center while still using DIV tags
				Posted: Thu Feb 18, 2010 5:12 am
				by Zerk
				Jackolantern wrote:Zerk wrote:It seems to be working in all browsers in any resolution above 1024x800 (or whatever that middle resolution is).
Under that is centered, but there is unneeded margins on both sides so you have to scroll sideways a bit...hmm
Hmmm...that is definitely a problem in today's world of various devices connecting to the web. Many platforms are using well under that resolution. Maybe it wasn't working before because of some clashing style in the page.
 
I'll probably keep digging into it.. hmm (for lack of a better thoughtful word)