Solarpitch Posted November 20, 2006 Share Posted November 20, 2006 Hey Guys,I am currently desiging the template for my site. I am having a problem trying to center the page in the center of the screen.http://www.gamespot.com/ --> has a perfect example of what I am talking about.I am bascially trying to position the page in the center of the screen and have the page right up against the top of the screen, as in the above example.I would just like a quick idea/example of how this is achieved if possible!Cheers! Quote Link to comment Share on other sites More sharing options...
fenway Posted November 21, 2006 Share Posted November 21, 2006 Tables make this very easy. Quote Link to comment Share on other sites More sharing options...
Solarpitch Posted November 21, 2006 Author Share Posted November 21, 2006 Haha . . I know that its just getting the table to position itself right in the center and right up against the top fo the screen! Quote Link to comment Share on other sites More sharing options...
ToonMariner Posted November 21, 2006 Share Posted November 21, 2006 Fenway...Do you even NOT use tables?Tables are evil!!!!To centre a page 'properly' using divs for layout - as god intended - simply specify a width of 100% to your html and then use margin: auto; in your cssso basic html...[code]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><link rel="stylesheet" type="text/css" href="/global/style/screen.css" media="screen" /><title>title</title></head><body><div id="header"></div><div id="wrapper"> <div id="nav"></div> <div id="info"></div> <div id="content"></div></div><div id="footer"></div></body></html>[/code]and css[code]html {width: 100%;}body {margin: 10px auto; width 765px;}.....[/code]obviously thats for a fixed width site, so alter as needed but that will give you a basic centered page.... Quote Link to comment Share on other sites More sharing options...
Solarpitch Posted November 21, 2006 Author Share Posted November 21, 2006 Cheers for that . . ill give it a try later when I finish work! :) Quote Link to comment Share on other sites More sharing options...
fenway Posted November 21, 2006 Share Posted November 21, 2006 Well, sure, for fixed-width, everything is easy in CSS -- you tell me that the way you have to fight with CSS to vertically align anything is "the way god intended". Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.