August 22, 2006
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;
}

Posted by illovich at August 22, 2006 01:39 PM
Comments

Hi Jim. You letter i received. Thanks! Photos is GREAT!!!!

Posted by: Slim on March 20, 2007 2:57 PM

Hello. I love your!

Posted by: Buy Viagra online pqm on May 2, 2007 9:37 PM

adult dvd

Posted by: adult dvd on May 8, 2007 8:22 PM

opftn onpy qwnxlztba toraduwe dhmnfz ponwbi tlzenp

Posted by: nlkq ylwbdge on September 12, 2007 5:19 AM

hello. i dont like vladimir putin.

Posted by: analacb on November 12, 2007 6:17 AM

hello. i dont like boris zhiglov.

Posted by: analkug on November 12, 2007 10:17 PM

hello. i dont like boris zhiglov.

Posted by: analmai on November 13, 2007 1:37 PM

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

Posted by: bsxg on November 23, 2007 8:17 PM
Post a comment
Name:


Email Address:


URL:


Comments:


Remember info?