I am currently building a website as part of my FinalMajor project for college.I have laid out all the divs where i want them all to be however i would like to position them all in the center of the browser instead of the left where they are now.
Is there a simple piece of code i can use to do this?
I am using a an external CSS sheets as well if that helps.
Any help is greatly appreciated
Adam
Last edited by designer21; 04-06-2012 at 09:13 PM..
I always like to supply valid code when providing examples to a newbie that may have no idea about DocTypes or how an .html document is laid out. We can always address linked/attached CSS later if needed.
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
html, body {
margin: 0;
background: #fc6;
}
#container {
height: 600px; /*for demo only*/
width: 800px;
margin: 30px auto;
background: #999;
}
</style>
</head>
<body>
<div id="container">
Your very interesting website would go here
<!--end container--></div>
</body>
</html>
Thanks for your help guys, for some reason when i tried putting a wrapper div it didn't center it with thhe margins set to auto howeer when i did the divs seperately they did, thanks again