Put all content inside <body> tags within a <div> tagged "wrapper". Add CSS styles to the "wrapper" div, setting its width to 900px and centering it using margin:0 auto. Be sure to comment the closing </div> tag to avoid errors.
1 of 2
Download to read offline
More Related Content
Centering page
1. Centering content
Put all your content - every single thing inside
1 the <body></body> element - in a div.
Name the div wrapper.
<body>
<div id=wrapper>
<p>Call me Ishmael. Some years ago -- never Definitely comment the closing of the
mind how long precisely -- having little or no div, or you will regret it later.
money in my purse, and nothing particular to
interest me on shore, I thought I would sail
about a little and see the watery part of the
world.</p>
</div><!-- end wrapper -->
</body>
2. Centering content
In the <head></head> of your page, add CSS
2 styles to the div with the id of wrapper
<style type=text/css>
Call me Ishmael. Some years ago -- never mind
#wrapper { how long precisely -- having little or no money
in my purse, and nothing particular to interest
width: 900px; me on shore, I thought I would sail about a little
and see the watery part of the world.
margin:0 auto;
}
</style>