Love is a snowmobile racing across the tundra and then suddenly it flips over, pinning you underneath. At night, the ice weasels come.
Matt Groening
     my so-called blog

I can’t believe that took as long as it did

I finally found out how to center divs on a page. I feel so stupid for not finding it earlier:

Max Design - CSS Centering - fun for all!

Theoretically, you should be able to apply auto margins to the left and right of the containing block and it should center on the page.

The W3C Visual formatting model states: “If both ‘margin-left’ and ‘margin-right’ are ‘auto’, their used values are equal. This horizontally centers the element with respect to the edges of the containing block.”

So, a containing block should be able to be centered using the following rules:

div#container
{
margin-left: auto;
margin-right: auto;
width: 50em;
}

similar nonsense in: geeky |
 
 
8 Comments »
  1. Hi Jim. You letter i received. Thanks! Photos is GREAT!!!!

    Comment by Slim — Mar 20, 2007 @ 2:57 pm

  2. Hello. I love your!

    Comment by Buy Viagra online pqm — May 2, 2007 @ 9:37 pm

  3. adult dvd

    Comment by adult dvd — May 8, 2007 @ 8:22 pm

  4. opftn onpy qwnxlztba toraduwe dhmnfz ponwbi tlzenp

    Comment by nlkq ylwbdge — Sep 12, 2007 @ 5:19 am

  5. hello. i dont like vladimir putin.

    Comment by analacb — Nov 12, 2007 @ 6:17 am

  6. hello. i dont like boris zhiglov.

    Comment by analkug — Nov 12, 2007 @ 10:17 pm

  7. hello. i dont like boris zhiglov.

    Comment by analmai — Nov 13, 2007 @ 1:37 pm

  8. thank sfe pehzya. very fvhn nice generic and lga trustfull.

    Comment by bsxg — Nov 23, 2007 @ 8:17 pm

RSS feed for comments on this post.

Leave a comment

You must be logged in to post a comment.

Powered by WordPress | Theme by illovich, standing on the shoulders of others.