Advanced Search Usage Terms Submit Contact
Dynamic Drive CSS Library
 
CSS Library
Submit an original CSS code
CSS Layouts
Web Graphics
Online Tools:
Last commented:

Dynamic Drive Blog Here

CSS Equal Columns Height script (v1.01)

Date: 11/02/2006 | By ddadmin | Comments: 209

A common pitfall of a CSS based columns layout is that the columns do not share a common height. Unlike a table based layout where the height of the table itself dictates the height of all of its columns, CSS columns are independent of one another in that respect. Now, this can be problematic (from a design standpoint) when you wish to style one of your CSS columns in a way that should extend all the way down to the end of the layout, such as giving a side column an explicit background color, a surrounding border etc.

This is a generic "CSS Equal Columns Height" script that will dynamically set the participating columns' heights to that of the tallest column's height, creating a uniform columns height layout. Use this script on any of our CSS Layouts for example. It's a matter of plug and play! To use this script, just insert this line of code into the HEAD section of your CSS layout page:

<script src="equalcolumns.js" type="text/javascript"></script>

As you can see, it references the external .js file "equalcolumns.js", which you should download (right click and select "Save As") and then upload to your own site.

This script is configured by default to automatically work with all of the layouts in our CSS Layouts section, whether 2 columns or 3 columns, fluid or fixed. Just add the script to the HEAD of any of these pages, and that's it!

If you wish to use this script to equalize the columns of your own custom CSS layout, open up "equalcolumns.js", and refer to the line:

ddequalcolumns.columnswatch=["leftcolumn", "rightcolumn", "contentwrapper"]

Change "leftcolumn", "rightcolumn" etc to the IDs of the CSS columns you wish to equalize. The script will do a check first to see if each corresponding column actually exists.

Your Comments (209)

Comment Pages 17 of 21 pages « First  <  15 16 17 18 19 >  Last »

Great works with IE7 & Mozilla Firefox! Thanks!
Posted by rezak on 04/07, 10:58 PM
Ah the wonders of re-learning css.
I've had a long hiatus from developing web content and have discovered that it is *not* like riding a bike. Thanks for this script. It has solved an issue that I'd been trying to fix with some really rough hacks. Once I have the site up and running, I'll throw a link up. As yet I haven't tested in any other browser except FF 2.0.0.13
I will eventually start testing in Opera (current version), and IE7.

Cheers again
Gryphonn
Posted by Gryphonn on 04/14, 05:17 AM
THANK YOU!!! Tried another script on a different website and it just didn't work. This is great!
Posted by Nadine on 04/28, 06:21 AM
Yeah very good for the tableless layouts.
Posted by website design on 05/15, 01:14 AM
Great script!!! Thx a lot.
Posted by angie on 05/29, 09:53 PM
Now I have a little problem....the script works great if I didn't use "TOC" or "Red More"....
As soon as I click to Read More, the length of the post gets much longer, esp. with Table Of Content.. the body is much too long than the outterwrapper.
Is there any way I can fix this problem?

Thx!
Angie
Posted by angie on 06/07, 05:00 AM
Am I supposed to not to use wrapper if using column?
Posted by angie on 06/07, 05:02 AM
Nope, doesn't work on liquid. I tried it and it keeps the divs on one height. The text just comes out when you resize it.
Posted by Xevo on 06/12, 04:53 PM
xevo, thank you for your reply.
Angie
Posted by angie on 06/12, 09:48 PM
It looks like that this script is full of errors. Where i will get correct code, so i can use it.
Posted by Dubai Web Design, Development on 06/30, 06:58 PM

Comment Pages 17 of 21 pages « First  <  15 16 17 18 19 >  Last »

Commenting is not available in this weblog entry.
Sponsors

Advertise Here

Copyright 2006-2011 Dynamic Drive Read our Usage Terms before using any of the CSS codes.