Center HTML content horizontally using CSS
1 2 #content { 3 margin: 0 auto; 4 width: 740px; 5 }
Your HTML would look something like this:
1 2 <div id="content"> 3 This is centered 4 </div>
DZone Snippets > alexwilliams > center
13493 users tagging and storing useful source code snippets
Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
Alex Williams http://www.alexwilliams.ca
1 2 #content { 3 margin: 0 auto; 4 width: 740px; 5 }
1 2 <div id="content"> 3 This is centered 4 </div>