Style Sheets
  Home arrow Style Sheets arrow Page 3 - Matching Web Page Columns with CSS
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Moblin 
JMSL Numerical Library 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
STYLE SHEETS

Matching Web Page Columns with CSS
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 3
    2007-07-18

    Table of Contents:
  • Matching Web Page Columns with CSS
  • Building a DIV-based web page layout with unleveled columns
  • Matching the heights of web page columns
  • Achieving a fully-balanced three-column web page layout

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Matching Web Page Columns with CSS - Matching the heights of web page columns


    (Page 3 of 4 )

    As I explained in the section that you just read, evening the columns of a specific web document is actually a process that can be performed with minor hassles, and certainly without the need to use the assistance of JavaScript. In this case, I'm going to use only a CSS-based approach to match the different heights of the corresponding web page columns.

    So, at this moment maybe you're wondering: how much does it take to fix the columns in question? Well, to be frank, the answer to that question is...only a few additional CSS styles. Yes, to keep the web document columns completely balanced, I'm going to include a simple wrapping DIV, which will be tasked obviously with containing each of the unleveled columns, in this way matching their respective heights.

    That being said, the CSS styles required to create the previously mentioned wrapping DIV can be coded as follows:

    #mainwrapper{
       clear: both;
       height: 100%;
       overflow: hidden;
       background: #eee;
    }

    #mainwrapper .leftcol{
       position: relative;
       float: left;
    }

    #mainwrapper .rightcol{
       position: relative;g
       float: right;
    }

    Basically, the function of the above basic CSS styles is simply to declare a new "mainwrapper" selector, which when used in conjunction with the respective "left" and "right" classes previously created, will make any DIV element contained in the wrapper in question float to the left or the right of a specific web page.

    As you can see, the addition of a simple wrapping DIV to the existing columns of a given web document is a basic -- yet efficient -- technique that really balances their heights, which implies that the issue can be quickly fixed by using a pure CSS-based methodology. In this case, I adapted this technique from a existing method created by Matthew Levine, which you can see in detail here

    Okay, at this stage hopefully you learned how the previously-defined wrapping DIV can be capable of keeping the columns of a web document entirely leveled. However, I must admit that you won't see the result of applying this technique until I show you how the previous CSS styles and the corresponding markup are linked with each other.

    Thus, taking into account this important requisite, in the next section I'm going to list the complete signature of the sample (X)HTML that you saw earlier, so you can see how a concrete web document can display its respective columns entirely balanced.

    To see how this will be done, jump ahead and read the next few lines. I'll be there, waiting for you.

    More Style Sheets Articles
    More By Alejandro Gervasio


       · While the topic has been covered already by many web designers, this article shows a...
       · I am just a beginner so I am looking at all the tutorial that I can find. I found...
       · Hi Susie,Thank you for the kind words on my CSS article. It's good to know that...
       · Ok, but what if you put only one paragraph in "centerbar" container and set its...
       · Thanks for the comments on my article. It’s very easy to solve the issue you...
       · As a beginner I appreciate the effort you put into making this information...
       · Hi Ron,Thank you for the comments on my CSS article, and it’s good to know it’s...
       · Does this work with a floating div design as well? See, I made a basic floating...
       · Thanks for this wonderful article. It works like a charm.I was wondering though,...
       · Thanks for the comments on my article. Wit reference to your question, yes it’s...
       · Hi Brett,Thanks for the kind comments on my article. Regarding your question,...
     

    STYLE SHEETS ARTICLES

    - Creating Hybrid Web Page Layouts with Negati...
    - Creating Three-Column Web Page Layous with N...
    - Swapping Column Positions in Web Page Layout...
    - Creating Web Page Layouts with Negative Marg...
    - Creating Gradients for Individual Containers...
    - Creating Gradients for Web Page Headers with...
    - SEO Scrolling Frames Problem Solved
    - Building Cross-Browser Background Effects wi...
    - CSS: Pseudo
    - Using PNG Images to Build Background Effects
    - CSS: Continuing the Clarification of CSS Cla...
    - CSS: Top Secret Classification
    - CSS: Dimensions
    - CSS: Margins and Padding
    - CSS: Crossing the Border






    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
    Stay green...Green IT