Hi,
I am having a lot of trouble with getting a horizontally centred layout to work. I am using the following code file I found on the internet as a starting point:
<html>
<head>
<title></title>
<meta http-equiv=“Content-Type” content=“text/html; charset=iso-8859-1” />
<style type=“text/css” media=“screen”><!–
body {
background-color: #e1ddd9;
font-size: 12px;
font-family: Verdana, Arial, Helvetica, SunSans-Regular, Sans-Serif;
color:#564b47;
padding:20px;
margin:0px;
text-align: center;
}
Content {
text-align: left;
vertical-align: middle;
margin: 0px auto;
padding: 0px;
width: 550px;
background-color: #ffffff;
border: 1px dashed #564b47;
}
p, h1, pre {
margin: 0px;
padding: 5px 10px;
}
h1 {
font-size: 11px;
text-transform:uppercase;
text-align: right;
color: #564b47;
background-color: #90897a;
}
a {
color: #ff66cc;
font-size: 11px;
background-color:transparent;
text-decoration: none;
}
–></style></head>
<body>
<div id=“content”>
<p><b>center a FIXED BOX</b><br /><br />
This BOX has a fixed width.<br />
It is centered and adjusts to the browser window.<br />
The height adjusts to the content.<br />
<a href=“/”>more nice and free css templates</a><br />
</p>
<p>
<img src=“xhtml10.gif” alt=“” width=“80” height=“15” border=“0”/> <img src=“css.gif” alt=“” width=“80” height=“15” border=“0”/>
</p>
</div>
</body>
</html>
this code works fine but the problem I have is when I add in more divs to the content div for segmenting my page content (for example to add in a header or an image gallery) essentially I am trying to position these new divs using absolute positioning but what seems to be happening is they are positioning from the body rather than the content div. This means I am unable to control where I want the elements on the page. I have also tried relative positioning but this doesnt help either!
I am very new to CSS but from the research I have done on the web the important line in the CSS above is:
margin: 0px auto; on the Content div to control the horizontal positioning
Any help that anyone could give me would be much appreciated as I am going crazy trying to work out where I am going wrong!! If you require any other information to help me please let me know and I will see what I can add.
many thanks in advance
Hayden