Center Website Content with CSS

Today in the days of high-resolution widescreen displays, it's annoying to visit websites that are formatted like it's 1990's. aligned all the way to the left. Make sure your website doesn't suffer the same fate by forcing it;s content to center horizontally and vertically.

[View All Snippets]
Show Plain Text »
  1. <style type="text/css">
  2. /* Center your website horizontally */
  3. .wrapper{
  4.    width:960px;
  5.    display:table;
  6.    margin:auto;
  7. }
  8.  
  9. /* Center certain content vertically */
  10. .container{
  11.    min-height: 10em;
  12.    display: table-cell;
  13.    vertical-align: middle;
  14. }
  15. </style>
  16.  
  17. <div class="wrapper">
  18.     <div class="container">
  19.         <p>Content goes here</p>
  20.     </div>
  21. </div>


Example:

 Content goes here

Create Your Free Account
Please remember that this information is essential to use our services correctly.
After creating the account you will be able to download all of our FREE products.
Fields marked with * are mandatory






Please send me information about updates, new products, specials and discounts from ApPHP!
We recommend that your password should be at least 6 characters long and should be different from your username/email. Please use only letters of the English alphabet to enter your name.

Your e-mail address must be valid. We use e-mail for communication purposes (order notifications, etc). Therefore, it is essential to provide a valid e-mail address to be able to use our services correctly.

All your private data is confidential. We will never sell, exchange or market it in any way. Please refer to Privacy Policy.

By clicking "Create Account", you are indicating that you have read and agree to the ApPHP Terms & Conditions.