iEntry 10th Anniversary Webforumz RegistrationAnnouncements Contact Webforumz StaffContact
Home Resources Blogs Meet the Team Contact Register

Go Back   WebForumz.com > Resources > FAQ > (X)HTML & CSS
Register All Albums Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read

Author


karinne
Karinne Legault is a Programmer Analyst working in Federal Government in Canada now working on .NET projects which she is still trying to get to grips with.

Her passion however is Web Design where she has 10 years experience. In the early years, just getting to grips with the movement of Web Standards being an integral part of the services she offers. You can view her portfolio site at KarinneLegault.com

RSS Feed

Your Options
How do I center my site horizontally?

 
how to make your website stay in the middle of the browser

The code is a pretty simple one. You need to wrap your whole site in a, what's now called, a wrapper (or container) div.

Here is what you HTML will look like with the added wrapper div

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en-US">

<head>

<title>Some title</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

</head>
<body>

<div id="wrapper">
<div id="content">Some content in here</div>
<div id="sidebar">Some sidebar stuff in here</div>
</div>

</body>
</html>

The CSS that makes the magic happen is apply auto to the margin property

#wrapper {
margin: 0 auto;
width: 780px;
background-color: #900;
}

Related Resources

Members's Comments No Comments. Be the first to comment on and rate this resource.


Search Engine Optimization by vBSEO 3.2.0 RC8