Forum Moderators: not2easy
I'm trying to create a two-column, fixed-width layout that is centered, kind of like this:
¦ Header ¦
-------------
¦Left----¦ R¦
¦--------¦--¦
¦--------¦--¦
¦--------¦--¦
-------------
But I'm stuck. I've figured out how to place the header image where I want it using margins and text-center. But how do I create these two columns and center them? I've played around quite a bit and can get columns whose positions are liquid based on the browser window size by using "left" and "right" positioning. Anyone that can help me get started with some example code?
Thanks in advance.
[edited by: D_Blackwell at 4:09 pm (utc) on May 17, 2004]
Here is an easy one on the fly:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>2-column fixed width example</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<style type="text/css">
body {
margin: 0;
padding: 0;
text-align: center; /*centers the content in IE5/win */
background: #fff;
}
#wrap {
width: 700px;
margin: 0 auto; /*centers the div in standard browsers */
text-align: left;
}
#left {
float:left;
width: 200px;
background: #eee;
}
#main {
margin: 0 0 0 220px;
width: 480px;
background: #eee;
}
</style>
</head>
<body>
<div id="wrap"> <!-- wrapping div -->
<div id="left"> <!-- begin left column -->
<ul>
<li>menu01</li>
<li>menu02</li>
<li>menu03</li>
<li>menu04</li>
<li>menu05</li>
</ul>
</div> <!-- end left column -->
<div id="main"> <!-- begin main column -->
<h3>Main content</h3>
<p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum.</p>
</div> <!-- end main column -->
</div> <!-- end wrapping div -->
</body>
</html>