Center HTML content horizontally using CSS
#content { margin: 0 auto; width: 740px; }
Your HTML would look something like this:
<div id="content"> This is centered </div>
DZone Snippets > alexwilliams > html
12388 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
#content { margin: 0 auto; width: 740px; }
<div id="content"> This is centered </div>
<a href="javascript:viewMore('two');" id="xtwo">... more</a> <p>I see one.</p> <p id="two" style="display:none">I see two.</p>
function viewMore(div) { obj = document.getElementById(div); col = document.getElementById("x" + div); if (obj.style.display == "none") { obj.style.display = "block"; col.innerHTML = "... less"; } else { obj.style.display = "none"; col.innerHTML = "... more"; } }