Archive for February 2009

Liquid Column Display Layout – Part II

In my earlier post I had discussed about the designing the liquid 3 column display layout. While developing the structure I had some problem with the column heights. Depending upon the contents length of those columns varies. I have declared the height property as auto in the css. I could have declared them with some specific pixel value to make the columns of equal length. But if you consider your pages to contain dynamic content generated by server side scripting then this technique may fail. Particularly in Internet Explorer the data part may be extended beyond the columns, which could make the structure awful. So I was in need to find some other solutions for that purpose.

I thought of using some JavaScript to make all the columns height equal. The algorithm to do this is very simple. Calculate the max height among three columns and assign it for all the columns. So first I introduced three different IDs for these three columns to access the properties of those columns using Javascript document.getElementById() method. So I changed the HTML code as follows:

  1. <div class="container">
  2.    <div class="contentDiv" id="contentDiv">
  3.       <div class="contentDiv_left" id="contentDiv_left"><img class="LcolImgDiv" src="../images/c2.jpg" border="0" alt="" /></div>
  4.       <div class="contentDiv_mid" id="contentDiv_mid">
  5.          <div class="hD1">Header Text</div>
  6.          <div class="hD2">Header text 2</div>
  7.          <p class="hD3">The text….</p>
  8.       </div>
  9.       <div class="contentDiv_right" id="contentDiv_right">
  10.          <ul>
  11.             <li><a class="item1" href="director/index.html">DIRECTOR SPEAKS </a> <img src="../images/bullet1.gif" alt="" vspace="0" /></li>
  12.             <li><a class="item1" href="students/index.html">STUDENTS </a> <img src="../images/bullet1.gif" alt="" vspace="2" /></li>
  13.             <li><a class="item1" href="alumni/index.html">ALUMNI </a> <img src="../images/bullet1.gif" alt="" vspace="2" /></li>
  14.          </ul>
  15.       </div>
  16.    </div>
  17.    <div class="footerDiv">
  18.       <div class="footerDivText">Copyright text</div>
  19.    </div>
  20. </div>

contentDiv_left for the left column, contentDiv_mid for the middle column and contentDiv_right for the right one. contentDiv ID for the container div for these 3 columns.

Continue reading ‘Liquid Column Display Layout – Part II’ »