...

View Full Version : css border not working



harkly
06-18-2010, 08:46 PM
I have a 2 column layout that changes based on info user selects, it is dynamic.

I have a border running down left side of the right column and it looks good when there is equal the amount of info in both column, however the problem is when there is less info in the right column then the line is to short.

I've switched it around and still have the same issue becuase the length of each column is based on what a user selects.

Can anyone give me some suggestions as to what to do to help this??

here is the code


<style type="text/css">

#container
{
width: 90%;
margin: 10px auto;
background-color: #fff;
color: #333;
border: 1px solid gray;
line-height: 130%;
}

#top
{
padding: .5em;
background-color: #ddd;
border-bottom: 1px solid gray;
}

#top h1
{
padding: 0;
margin: 0;
}

#leftnav
{
float: left;
width: 160px;
margin: 0;
padding: 1em;
}

#content
{
margin-left: 200px;
border-left: 1px solid gray;
padding: 1em;
max-width: 36em;
}

#footer
{
clear: both;
margin: 0;
padding: .5em;
color: #333;
background-color: #ddd;
border-top: 1px solid gray;
}

#leftnav p { margin: 0 0 1em 0; }
#content h2 { margin: 0 0 .5em 0; }
</style>



HTML CODE
<div id="container">
<div id="top">
<h1>Header</h1>
</div>
<div id="leftnav">
<p>
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut.
</p>
</div>
<div id="content">
<h2>Subheading</h2>


</div>
<div id="footer">
Footer
</div>
</div>

Excavator
06-19-2010, 12:30 AM
Hello harkly,
The easiest way to get a border down the middle that works no matter which column has more content would be the "faux columns" method of using a background image. Look at this example of faux columns (http://nopeople.com/CSS/faux_columns/index.html).
Google faux columns for a bunch more examples.

Here's another way to do it (http://nopeople.com/CSS/fluid_width/index.html).



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum