You're over complicating things a little as there's no need for the hacks or relative/absolute positioning to achieve a layout like that.
You're also using an XHTML 1.1 doctype which you don't need so go for the HTML4.01 doctype unless you really do need to deliver XHTML (in which case use XHTML 1.0).
Try something like this
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Demo</title>
<style type="text/css">
* {
padding: 0;
margin: 0;
}
body {
padding: 10px;
width: 950px;
margin: 0 auto;
font-family: verdana, arial, helvetica, sans-serif;
font-size: 73%;
}
h1 {
font-size: 100%;
text-align: center;
padding-bottom: 5px;
}
p {
padding-bottom: 0.7em;
}
#container {
background-color: #B4CDB3;
padding: 5px;
}
#mainnav {
text-align: right;
width: 100%;
background-color: #CDB3B3;
}
#mainnav li {
display: inline;
}
#maincontent {
width: 260px;
margin: 5px auto;
background-color: #B3C4CD;
}
#footer {
text-align: right;
width: 100%;
background-color: #CDB3B3;
}
#footer li {
display: inline;
padding-left: 5px;
}
</style>
</head>
<body>
<div id="container">
<ul id="mainnav">
<li><a href="http://www.mysite.com/login/"> Login </a></li>
</ul>
<div id="maincontent">
<h1>Hello, Welcome to my site</h1>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. In dictum lectus fermentum erat. Pellentesque eu felis. Nullam vitae sapien eget velit tincidunt convallis. Donec neque. Mauris non mi.</p>
<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Cras vitae magna. Integer quis quam nec sapien interdum consectetuer. Quisque dolor. Donec luctus ultrices elit. Suspendisse justo. Nunc mauris neque, porta at, viverra quis, feugiat id, sapien. Integer et metus.</p>
</div>
<ul id="footer">
<li><a href="http://www.mysite.com/about/">about</a></li>
<li><a href="http://www.mysite.com/contact/">contact</a></li>
</ul>
</div>
</body>
</html>
I've added background colours so you can see what's happening for each element but feel free to remove these.
Bookmarks