Hi, I am working on a website and I am trying to get the two columns on my layout to always be equal heights using CSS. I have went through numerous tutorials on how to equal columns using multiple containers or faux images, but I can not seem to figure it out. If anyone could give me a hand I would really appreciate it. Here is my current code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled</title>
<style type="text/css">
<!--
body {
margin: 0; /* it's good practice to zero the margin and padding of the body element to account for differing browser defaults */
padding: 0;
text-align: center; /* this centers the container in IE 5* browsers. The text is then set to the left aligned default in the #container selector */
color: #000000;
background-image: url(Assets/Images/Sun/Sun_back.jpg);
background-repeat: no-repeat;
background-color: #000000;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 100%;
}
#container {
width: 1020px;
margin: 0 auto; /* the auto margins (in conjunction with a width) center the page */
text-align: left;
}
#header {
background-image: url(Assets/Images/header.png);
background-repeat: no-repeat;
background-position: top;
height: 84px;
padding: 0;
}
#header h1 {
margin: 0;
padding: 0px;
}
#menu {
background-image: url(Assets/Images/Sun/menu.png);
background-repeat: no-repeat;
background-position: top;
height: 70px;
padding: 0;
}
#menu h1 {
margin-top: 0px;
margin-right: 60px;
margin-bottom: 0px;
margin-left: 111px;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
padding-top: 21px;
padding-right: 0px;
padding-bottom: 0px;
padding-left: 0px;
}
#sidebar1 {
width: 391px;
background-image: url(Assets/Images/Sun/leftbar.png);
background-repeat: repeat-y;
background-position: left top;
padding: 0px;
float: left;
}
#copyright {
height: 54px;
text-align: center;
}
#sidebar1 p {
margin-left: 111px;
margin-right: 26px;
margin-top: 0px;
margin-bottom: 0px;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10pt;
font-weight: bold;
line-height: 17px;
}
#sidebar1 h3 {
margin-left: 111px;
margin-right: 26px;
margin-top: 0px;
margin-bottom: 0px;
}
#mainContent {
background-image: url(Assets/Images/Sun/maincontent.png);
background-repeat: repeat-y;
width: 629px;
background-position: right top;
margin: 0;
padding: 0;
float: right;
}
#mainContent p {
margin-right: 60px;
margin-top: 0px;
margin-bottom: 0px;
margin-left: 0px;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10pt;
font-weight: bold;
line-height: 17px;
}
#mainContent h1 {
margin-right: 60px;
margin-top: 0px;
margin-bottom: 0px;
margin-left: 0px;
}
#footer {
background-image: url(Assets/Images/Sun/footer.png);
background-repeat: no-repeat;
background-position: top;
height: 127px;
padding: 0;
}
#footer p {
margin-top: 0;
margin-right: 0px;
margin-bottom: 0;
margin-left: 111px;
padding-top: 11px;
padding-right: 0;
padding-bottom: 0;
padding-left: 0;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 11px;
font-weight: bold;
}
.fltrt { /* this class can be used to float an element right in your page. The floated element must precede the element it should be next to on the page. */
float: right;
}
.fltlft { /* this class can be used to float an element left in your page */
float: left;
}
.clearfloat { /* this class should be placed on a div or break element and should be the final element before the close of a container that should fully contain a float */
clear:both;
height:0;
font-size: 1px;
line-height: 0px;
}
a:link {
color: #000000;
}
a:visited {
color: #000000;
}
a:hover {
color: #000000;
}
a:active {
color: #000000;
}
-->
</style>
<!--[if IE 5]>
<style type="text/css">
/* place css box model fixes for IE 5* in this conditional comment */
.twoColFixLtHdr #sidebar1 { width: 230px; }
</style>
<![endif]--><!--[if IE]>
<style type="text/css">
/* place css fixes for all versions of IE in this conditional comment */
.twoColFixLtHdr #sidebar1 { padding-top: 30px; }
.twoColFixLtHdr #mainContent { zoom: 1; }
/* the above proprietary zoom property gives IE the hasLayout it needs to avoid several bugs */
</style>
<![endif]-->
</head>
<body class="twoColFixLtHdr">
<div id="container">
<div id="header">
<!-- end #header -->
<img src="Assets/Images/trans_mood.gif" width="1007" height="84" border="0" usemap="#Map" />
<map name="Map" id="Map"><area shape="rect" coords="247,65,270,77" href="#" alt="Water Mood" />
<area shape="rect" coords="773,11,1005,76" href="index.html" alt="Home" />
<area shape="rect" coords="218,65,241,77" href="#" alt="Earth Mood" />
<area shape="rect" coords="189,65,212,77" href="#" alt="Sun Mood" />
</map></div>
<div id="menu">
<h1><a href="index.html">Home</a> | <a href="story.html">My Story</a> | <a href="kundalini.html">Kundalini Teacher</a> | <a href="tap.html">Tap Therapy</a> | <a href="dvd.html">DVD Products</a> | <a href="contact.html">Contact Us</a> | <a href="storymonth.html">Story of the Month</a></h1>
<!-- end #menu -->
</div>
<div id="sidebar1">
<h3>Sidebar1 Content</h3>
<p>The background color on this div will only show for the length of the content. If you'd like a dividing line instead, place a border on the left side of the #mainContent div if it will always contain more content. </p>
<p>Donec eu mi sed turpis feugiat feugiat. Integer turpis arcu, pellentes</p>
<!-- end #sidebar1 -->
</div>
<div id="mainContent">
<h1> Main Content </h1>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Praesent aliquam, justo convallis luctus rutrum, erat nulla fermentum diam, at nonummy quam ante ac quam. Maecenas urna purus, fermentum id, molestie in, commodo porttitor, felis. Nam blandit quam ut lacus. Quisque ornare risus quis ligula. Phasellus tristique purus a augue condimentum adipiscing. Aenean sagittis. Etiam leo pede, rhoncus venenatis, tristique in, vulputate at, odio. Donec et </p>
<!-- end #mainContent -->
</div>
<!-- This clearing element should immediately follow the #mainContent div in order to force the #container div to contain all child floats --><br class="clearfloat" />
<div id="footer">
<p>Footer</p>
<!-- end #footer --></div>
<div id="copyright">
<img src="Assets/Images/copyright.png" alt="Copyright" width="507" height="54" align="top" />
<!-- end #copyright --></div>
<!-- end #container --></div>
</body>
</html>