3
Apr/090
Apr/090
How To Center a Page With CSS
When designing the layout of a web page, it is common to want to center the entire page. Luckily, this is very easy to do without breaking standards. All you have to do is wrap the entire page with a div with the left and right margins set to auto (margin: 0px auto;).
Here is an example:
<html> <body> <div class="wrapper">Contents of page...</div> </body> </html>
.wrapper { margin: 0px auto; width: 600px; }
Here, margin specifies the top/bottom and the left/right respectively.
That's all there is to it!
Categories
- General (6)
- News (4)
- Projects (10)
- Lock My Stuff (2)
- TempServers (8)
- Software (7)
- Tips & Tutorials (42)
Archives
- [+]2010 (3)
- [+]2009 (46)
- [+]December (5)
- [+]November (3)
- [+]October (2)
- [+]September (4)
- [+]August (4)
- [+]July (4)
- [+]June (6)
- [+]May (4)
- [+]April (4)
- [+]March (4)
- [+]February (2)
- [+]January (4)
- [+]2008 (15)
- [+]December (14)
- AJAX Loading Image Generator
- Reloading Images Using JavaScript
- Creating a CAPTCHA in PHP with GD
- Bypassing Register_Globals in PHP
- Toggle Display of Page Elements with JavaScript
- What is AJAX?
- WordPress 2.7 Released
- LMS New Feature: Email Form
- Strong Passwords
- ISPConfig - Open Source Web Hosting Panel
- Simple PHP Page Template System
- Creating an Upload Progress Bar in PHP with APC
- Introducing LockMyStuff.com
- About This Blog (WordPress)
- [+]November (1)
- [+]December (14)
