1

I want to create a blogger design with 2 column layout, the right column positioned top as same as header but also I want its height to be approaching on the footer regardless of the the content of left column.

Here's the layout I want to be:

alt text

CSS Code:

#center {
    float: left;
    overflow: hidden;
    background: #f0f0f0;
}
#center div {
    float: left;
    margin-bottom: -2000px;
    padding-bottom: 2000px;
}
#center .col1 {
    width:700px;
    margin-right: 5px;
}
#center .col2 {
    margin-right: 0;
    width:200px;
    background:#000000;
    overflow:hidden;

}
.clear {
    clear:both;
    display:block;
    overflow:hidden;
    visibility:hidden;
    width:0;
    height:0
}
.content {
    padding:10px;
}
.footer {
    background:#99FF99;
}
.sidebar {
    margin-left: 5px;
    margin-right: 5px;
    color:#FFFFFF;
}
#Image1 {
    position:absolute;
    top:10px;
}

HTML Code:

<div class="container">
  <div class="header-wrapper">
    <div class="header">
    <h1>Blog Title</h1>
    Integer nec neque. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Praesent dictum venenatis velit. Morbi interdum eleifend sapien. Morbi a mauris</div>
  </div>
</div>
<div class="clear"></div>
<div class="container">
  <div id="center" class="grid">
    <div class="col1">
      <div class="content">
        <p>Left Content</p>
      </div>
    </div>
    <div class="col2">
      <div class="content sidebar">
        <div id="Image1" class="widget Image">
          <div class="widget-content"> <img width="180" height="201" src="Image SRc" id="Image1_img" alt=""> <br>
          </div>
        </div>
        <p>righ text</p>
      </div>
    </div>
  </div>
</div>
<div class="clear"></div>
<div class="container">
  <div class="footer">Footer</div>
</div>
mauris
  • 42,982
  • 15
  • 99
  • 131
christian
  • 153
  • 2
  • 13
  • Have you tried giving it a height: 100%; ? –  Jan 11 '11 at 13:47
  • http://stackoverflow.com/questions/4514322/is-it-possible-to-get-a-divs-height-to-be-100-of-an-available-area http://stackoverflow.com/questions/1122381/how-to-force-child-div-to-100-of-parents-div-without-specifying-parents-height – Michael Davis Jan 11 '11 at 16:28

1 Answers1

1

If you just want the answer without taking the journey, here:

CSS:

<style media="screen" type="text/css">
    #container2 {
        clear:left;
        float:left;
        width:100%;
        overflow:hidden;
        background:#ffa7a7; /* column 2 background colour */
    }
    #container1 {
        float:left;
        width:100%;
        position:relative;
        right:50%;
        background:#fff689; /* column 1 background colour */
    }
    #col1 {
        float:left;
        width:46%;
        position:relative;
        left:52%;
        overflow:hidden;
    }
    #col2 {
        float:left;
        width:46%;
        position:relative;
        left:56%;
        overflow:hidden;
    }
    #footer {
        clear:both;
        float:left;
        width:100%;
    }
</style>

HTML

<div id="header">
</div>
<div id="container2">
    <div id="container1">
        <div id="col1">
        </div>
        <div id="col2">
        </div>
    </div>
</div>
<div id="footer">
</div>

DEMO

S16
  • 2,963
  • 9
  • 40
  • 64