Connecting Tech Pros Worldwide Forums | Help | Site Map

Match height of greater column

dlite922's Avatar
Expert
 
Join Date: Dec 2007
Location: Moon, Dark Side
Posts: 1,095
#1: Dec 10 '08
This might be a javascript problem, but I want to see if there's any way in CSS to do it first.

I have two floating divs, one wide on the left contains the "content" of the page, the second narrow one contains a skyscraper (vertical) advertisement.

Since the height of the content could be more or less than the advertisement, I want the advertisement column to match the content height IF the content is longer, or the content height match the advertisement if content is smaller than the advertisement-container height.

If I set a minimum height the content will still extend past it if the content is long, I don't want to add scroll bar to content div.

Here's an example page:

http://www.zankobooks.com/faq

Thanks for any help, I think I can do it with javascript, but I'd have to assign IDs to the divs and make sure all the content containers on all pages have the same ID. THEN i'll be able to put it in my global js file to match the height values.

Thanks!



Dan

drhowarddrfine's Avatar
Expert
 
Join Date: Sep 2006
Posts: 5,579
#2: Dec 10 '08

re: Match height of greater column


I'm on the road so I can't look up my solution. Couple options. Google for 'faux columns'. Personally, I find it icky but a lot of people use it. Second option is using absolute positioning but that may complicate things. And c) would require wrapping a couple additional divs around the whole thing but may not be as complicated.

So, for that, google for "equal height css columns".
Member
 
Join Date: Nov 2008
Posts: 80
#3: Dec 15 '08

re: Match height of greater column


Equalising Columns in CSS

Quote:
Before you start you should know that the only element that will base its height dependent on another elements height is a table-cell. Therefore if you want equalising columns in your layout then a table may still be the best alternative until there is full-support for display:table.

There are some ways however to give the illusion of equal columns and I will show you some techniques below which vary in difficulty and usefulness.
Reply