tags:

views:

49

answers:

2

It's not easy to explain very well what I'm having problem with so I have attached an image:

http://test.richardknop.com/test.gif

Here is my simplified XHTML markup so far:

<div id="page">

    <div id="content">

    </div>

    <div id="sidebar">

    </div>

</div>

How to style it?

I'm getting a little bit desperate and I'm not even sure it's possible.

+1  A: 

Richard, I think your thinking about the problem is wrong. You are thinking about these 2 items as one thing. You need to separate them.

Make footer/border a separate div and make sure it's always at the bottom. I think that's pretty straight forward.

Also make sure that your sidebar is the same size as your content. Put your images in the sidebar - and make them stick to the bottom like your footer. I usually use some sort of framework to make this easier - try out blueprint or elasticss

HTML:

<html>
<head>
<link rel="stylesheet" href="1732288.css" type="text/css" media="screen, projection">
</head>
<body>
<div id="page">
    <div id="sidebar">
     <div id="sidebar-content">
     Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam congue iaculis ultrices. Nam vitae odio ut nisl dignissim pretium. Donec pulvinar gravida felis, sed pretium risus aliquet ornare. Praesent accumsan libero rhoncus tortor semper bibendum. Nunc eleifend ante turpis. Aliquam sit amet ipsum orci, sit amet convallis erat. Morbi arcu dui, ultrices vel dapibus ac, viverra in odio. Proin imperdiet sollicitudin felis vestibulum porta. Aenean ac nisi nunc, et auctor sem. Praesent vitae erat augue. Suspendisse malesuada interdum consequat. Aenean laoreet molestie elit ut placerat.
     </div>
     <div id="sidebar-bottom">
      <div id = "image-1">
      image 1
      </div>
      <div id = "image-2">
      image 2
      </div>
     </div>
    </div>

    <div id="content">
    <p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam congue iaculis ultrices. Nam vitae odio ut nisl dignissim pretium. Donec pulvinar gravida felis, sed pretium risus aliquet ornare. Praesent accumsan libero rhoncus tortor semper bibendum. Nunc eleifend ante turpis. Aliquam sit amet ipsum orci, sit amet convallis erat. Morbi arcu dui, ultrices vel dapibus ac, viverra in odio. Proin imperdiet sollicitudin felis vestibulum porta. Aenean ac nisi nunc, et auctor sem. Praesent vitae erat augue. Suspendisse malesuada interdum consequat. Aenean laoreet molestie elit ut placerat.
</p>
    <p>
Maecenas pellentesque elementum sapien, eu imperdiet turpis scelerisque pulvinar. Proin elit elit, condimentum non lacinia quis, congue vel justo. Sed rutrum magna quis neque sollicitudin vestibulum. Morbi ut eros vitae metus rhoncus sodales. Donec vel velit sed orci imperdiet tristique vel sed odio. Duis eget tellus purus. Sed blandit, tortor nec luctus tempor, tellus elit rutrum nibh, vel egestas libero velit eu libero. Nullam rhoncus, sem in ornare aliquet, dui purus consectetur felis, vitae porta elit leo et eros. Integer pharetra, mauris in lobortis aliquam, est eros commodo ante, sit amet facilisis mauris ipsum pharetra risus. Etiam vel nulla justo. Curabitur pretium facilisis consectetur. Aenean et mauris eros, nec pulvinar diam. Integer ut diam non leo ullamcorper vehicula a in mi. Curabitur adipiscing, enim feugiat porttitor pretium, lacus justo sodales odio, et congue mi sem sed ligula. Etiam accumsan accumsan tortor id pretium.
</p>
    <p>

Curabitur quis nunc turpis, vitae vestibulum magna. Aliquam ultrices mi eget arcu convallis feugiat. Integer lacinia ipsum suscipit justo dapibus ultrices. Ut quis arcu vel nibh tincidunt tempus. Quisque imperdiet fermentum leo a ultrices. Donec arcu odio, congue eget elementum a, dignissim at felis. Donec in nibh dui. Curabitur adipiscing consequat urna, sed vehicula neque molestie at. Sed consequat metus velit. Nunc justo neque, tincidunt et faucibus et, mattis sit amet nulla. Integer elementum, purus in malesuada mollis, orci nisi ullamcorper nisl, quis tempor nunc augue et arcu. Integer massa metus, faucibus et vestibulum at, egestas vel enim. Integer condimentum sollicitudin sollicitudin. Nulla volutpat ultricies mauris, eget hendrerit eros accumsan ac. Suspendisse aliquam, lacus ut fringilla auctor, sem sapien elementum nulla, a hendrerit enim turpis vitae dolor. Pellentesque ac mi quis ipsum commodo venenatis. 
</p>
    </div>



</div>
<div id = "footer">
 footer
</div>
</body>
</html>

CSS:

body{
    background: #eee;
}
#page{
    background: #cccccc;
    width: 800px;
}
#sidebar{
    background: #999;
    width: 200px;
    height: 100%;
    margin-right: 10px;
    float: left;
}
#sidebar-content{
    height: 90%;
}
#sidebar-bottom {
    height: 50px;
    vertical-align: bottom;
}

#image-1{
    width: 100px;
    float: left;
}

#content{
    height: 100%;
    left: 200px;
    background: #333;
}

#footer{
    background: #3ee;
}

You can play around and make it centered and such - but this is the gist of it without using any frameworks.

Here is the solution online : http://www.gorbikoff.com/stuff/1732288.htm

Css is at: http://www.gorbikoff.com/stuff/1732288.css

Nick Gorbikoff
But the images are not always supposed to be at the bottom. If there is only little content, they should not be on the bottom of the page.
Richard Knop
Richard if you design it this way they will be at the bottom of the sidebar - which you should make to be always equal to content. Let me put up somethign in paintshop to explain what I mean. brb :-)
Nick Gorbikoff
Well, the problem is I don't know how to make the sidebar's height equal to the content's height. Content is dynamic so the height is not fixed.
Richard Knop
Nesting is the answer to your problem.If you nest enough - it will give enough control over major parts of the site and little divs inside.http://gorbikoff.com/stuff/stackoverflow-1732288.pngIf you set it up like that then you can also nest your sidebar content to make sure it stays at top and looks different.
Nick Gorbikoff
To your last comment you can use even more nesting - and put both of the sidebar and content into one superdiv and call it main or something. But I would recommend checking out blueprint or elasticss. In elasticss you have a painless way to create fluid designs and equal height columns. IN blueprint you can also do this.
Nick Gorbikoff
updated answer - see above.
Nick Gorbikoff
+1  A: 

Like this:

#page {
   position:relative;
   overflow:hidden;
}

#page .images {
   position:absolute; bottom:0; left: 0; width: $width-of-sidebar;
}

#sidebar {
   padding-bottom: $height-of-the-image;
   float:left;
}

To get background in the sidebar you'll need faux columns technique.

porneL
http://www.alistapart.com/articles/fauxcolumns/
richard