tags:

views:

7795

answers:

4

Hi Everyone,

I've been banging my head against the wall for hours trying to figure out this issue and think it must be something small I'm missing. I've searched online, but nothing I have found seems to work. The HTML is:

<body>
<div id="header">
<div id="bannerleft">
</div>
<div id="bannerright"><div id="WebLinks">
<span>Web Links:</span>
<ul>
<li><a href="#"><img src="../../Content/images/MySpace_32x32.png" alt="MySpace"/></a></li>
<li><a href="#"><img src="../../Content/images/FaceBook_32x32.png" alt="Facebook"/></a></li>
<li><a href="#"><img src="../../Content/images/Youtube_32x32.png" alt="YouTube"/></a></li>
</ul>
</div></div>
</div>
<div id="Sidebar">
<div id="SidebarBottom">
</div>
</div>
<div id="NavigationContainer">
<ul id="Navigation">
<li><a href="#">Nav</a></li>
<li><a href="#">Nav</a></li>
<li><a href="#">Nav</a></li>
<li><a href="#">Nav</a></li>
<li><a href="#">Nav</a></li>
<li><a href="#">Nav</a></li>
<li><a href="#">Nav</a></li>
<li><a href="#">Nav</a></li>
<li><a href="#">Nav</a></li>
<li><a href="#">Nav</a></li>
</ul>
</div>
<div id="Main">
<asp:ContentPlaceHolder ID="MainContent" runat="server" />
</div>
</body>

My full CSS is:

*
{
    margin:0px;
    padding:0px;
}

body 
{
    font-family:Calibri, Sans-Serif;
    height:100%;
}
#header
{
    width:100%;
    z-index:1;
    height:340px;
    background-image:url("../../Content/images/bannercenter.gif");
    background-repeat:repeat-x;
}
#header
#bannerleft
{
    float:left;
    background-image:url("../../Content/images/bannerleft.gif");
    background-repeat:no-repeat;
    height:340px;
    width:439px;
    z-index:2;
}
#bannerright
{
    float:right;
    background-image:url("../../Content/images/bannerright.gif");
    background-repeat:no-repeat;
    width:382px;
    height:340px;
    background-color:White;
    z-index:2;
}
#Sidebar
{
    width:180px;
    background:url("../../Content/images/Sidebar.png") repeat-y;
    z-index:2;
    height:100%;
    position:absolute;
}
#SidebarBottom
{

    margin-left:33px;
    height:100%;
    background: url("../../Content/images/SidebarImage.png") no-repeat bottom;
}
#NavigationContainer
{
position:absolute;
top:350px;
width:100%;
background-color:#bbc4c3;
height:29px;
z-index:1;
    left: 0px;
}
#Navigation
{
margin-left:190px;
font-family:Calibri, Sans-Serif;
}
#Navigation li
{
float:left;
list-style:none;
padding-right:3%;
padding-top:6px;
font-size:100%;
}
#Navigation a:link, a:active, a:visited
{
color:#012235;
text-decoration:none;
font-weight:500;
}
#Navigation a:hover
{
    color:White;
}
#WebLinks
{
float:right;
color:#00324b;
margin-top:50px;
width: 375px;
}
#WebLinks span
{
float:left;
margin-right:7px;
margin-left:21px;
font-size:10pt;
margin-top:8px;
font-family:Helvetica;
}
#WebLinks ul li
{
float:left;
padding-right:7px;
list-style:none;
}
#WebLinks ul li a
{
text-decoration:none;
font-size:8pt;
color:#00324b;
font-weight:normal;
}
#WebLinks ul li a img
{
    border-style:none;
}
#WebLinks ul li a:hover
{
    color:#bcc5c4;
}

I'd like the sidebar to stretch in height with the content of my page and leave the sidebar bottom image always at the bottom of the sidebar. Is there something I'm missing or any tips? Thanks!

Jon

+1  A: 

Perhaps Multi-Column Layouts Climb Out of the Box is what you're looking for?

strager
A: 

I think your solution would be to wrap your content container and your sidebar in a parent containing div. Float your sidebar to the left and give it the background image. Create a wide margin at least the width of your sidebar for your content container. Add clearing a float hack to make it all work.

apphacker
+1  A: 

Clearly you are looking for the Faux columns technique :-)

By how the height-property is calculated, you cant set height: 100% inside something that has auto-heigh.

Arve Systad
Using the faux columns technique was the closest I was able to get. The problems I ran into were that I couldn't make the sidebar overlap on top of the navigation bar and I couldn't figure out how to put the "sidebar bottom" image always at the bottom of the sidebar.
Jon
If you have one main-container, in which you have the background for the entire page, you can use the sidebar-bottom-image like this: `background: url(blabla) no-repeat bottom;`. Making the sidebar overlap on top of the navigation bar could also be solved by "emulating" the sidebar in the nav-bar-background. If this makes no sense to you, would you stick up a sketch of what you are trying to achieve? :)
Arve Systad
put teh sidebar bottom image in the site footer but use position relative or absolute, or neagative top margin, tp lift it up so it appears on top of the sidebar.
wheresrhys
A: 

I have run into this issue several times on different projects, but I have found a solution that works for me. You have to use four div tags - one that contains the sidebar, the main content, and a footer.

First, style the elements in your stylesheet:

#container {
width: 100%;
background: #FFFAF0;
}

.content {
width: 950px;
float: right;
padding: 10px;
height: 100%;
background: #FFFAF0;
}

.sidebar {
width: 220px;
float: left;
height: 100%;
padding: 5px;
background: #FFFAF0;
}

#footer {
clear:both;
background:#FFFAF0;
}

You can edit the different elements however you want to, just be sure you dont change the footer property "clear:both" - this is very important to leave in.

Then, simply set up your web page like this:

<div id=”container”>
<div class=”sidebar”></div>
<div class=”content”></div>
<div id=”footer”></div>
</div>

I wrote a more in-depth blog post about this at http://blog.thelibzter.com/how-to-make-a-sidebar-extend-the-entire-height-of-its-container. Please let me know if you have any questions. Hope this helps!

Libby