November 2, 200916 yr I have done this lots of times before, I was just wondering what other users considerd the best way to centre there web page.
November 2, 200916 yr I have done this lots of times before, I was just wondering what other users considerd the best way to centre there web page. I use the margin method with css #wrapper { margin: 0 auto; width:960px; } The first 0 is the top and bottom margin, the auto is the left and right. You can also use fixed, absolute or relative positioning. #wrapper { width:960px; position:fixed; left:300px; top:20px; } I prefer the top method, but it really does depend on what images your using etc
November 2, 200916 yr Theres a whole thread just on this topic. here: http://www.webdesignerforum.co.uk/topic/2529-how-to-center-a-site-using-css/
November 2, 200916 yr Faevilangel that second method you used wouldn't work? Should be width: 960px; left 50%; margin-left: -480px;
November 2, 200916 yr Author I tried #wrapper { margin: 0 auto; width:960px; } In a web page today, and i'm not sure if it was IE or something else but it didn't work?
November 2, 200916 yr I tried #wrapper { margin: 0 auto; width:960px; } In a web page today, and i'm not sure if it was IE or something else but it didn't work? It really depends on how you coded your site and what doctype you used as it if it will work, you can have a look at a tutorial I wrote about it on my blog which might help you out, which is slightly more in-depth then the one I wrote for this forum: http://webdesignpond.co.uk/wdp/tips-tutorials/how-to-horizontally-center-a-site/ If that doesn't work then post a link to your site or the code if it is offline and I'm sure someone would be able to help you out
Create an account or sign in to comment