Solved

Auto Adjust height of column on right

Posted on 2011-09-13
14
391 Views
Last Modified: 2012-05-12
Hi

   Please take a look here -  http://tinyurl.com/cityads


I want the column on right that has the search box  to auto adjust itself to be of the same height as the content column on left.


So if the height of the column on left increases or decreases the right column should adjust itself to the same height so both of them are at the same level from top to bottom and the page looks good.


How can i do this?
0
Comment
Question by:ee-itpro
  • 6
  • 4
  • 4
14 Comments
 
LVL 1

Expert Comment

by:rsmithnt
ID: 36529708
I would use something like jquery
0
 
LVL 30

Expert Comment

by:LZ1
ID: 36529716
You can do this in a variety of ways. Are you opposed to Jquery/Javascript or do you want a pure CSS solution?
0
 
LVL 30

Expert Comment

by:LZ1
ID: 36529727
0
 

Author Comment

by:ee-itpro
ID: 36529730
Not opposed to jquery but would prefer a css solution
0
 

Author Comment

by:ee-itpro
ID: 36529743
The link for css does not have the code, it only shows what the end result looks like
0
 
LVL 30

Expert Comment

by:LZ1
ID: 36529751
View the source:


div.eW { overflow:hidden; }
div.eW.eB { height:1px; font-size:0; }
div.eW div.eH { float:left; width:30%; background-color:#9F0; margin-right:5px; padding:10px; padding-bottom:9010px; margin-bottom:-9000px; border:1px solid #000; }

Open in new window

0
 
LVL 1

Expert Comment

by:rsmithnt
ID: 36529760
What browser are you programming for.  Sometimes a css solution may not be compatible with the browser.
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 30

Expert Comment

by:LZ1
ID: 36529796
I just noticed your using a strict Doctype. In the link I provided he's using a transitional. This will also effect the way the browser interprets the CSS.  We may want to look at the Jquery/JS solution.
0
 
LVL 1

Expert Comment

by:rsmithnt
ID: 36529889
$('#right_content').height($('#left_content_middle').height());

using jquery
0
 

Author Comment

by:ee-itpro
ID: 36529897
I am looking at cross browser support mainly FF, Ie, Chrome ... support for older versions of these browsers as well(ie 6 as well if possible)


I'm not proficient with css, so can you please explain me how that css code that you provided works


Are these 3 different divs , the last 2 inheriting any properties from the first one?

div.eW

div.eW.eB

div.eW div.eH


I'd look at Jquery but if the Javascript support is turned off for the browser it won't work.
0
 
LVL 30

Expert Comment

by:LZ1
ID: 36529954
If JS is turned off on the browser, they probably won't be browsing your site anyways. Better than 90% of users have JS on with some protection on the OS or browser side of things.

To answer your question though what they are doing is using a large amount of padding-bottom as well as margin-bottom. (the same amount actually).  Then your parent div, will have overflow:hidden to hide anything that won't have actual content.
0
 
LVL 1

Expert Comment

by:rsmithnt
ID: 36529970
LZ1 is correct.  In my opinion jquery is your best cross browser solution.
0
 
LVL 30

Accepted Solution

by:
LZ1 earned 500 total points
ID: 36530030
In order to use the pure CSS solution you'll have to do the following:
1. Give each column a class of .col
2. Use this CSS:
.col{padding:10px 10px 9000px !important;margin-bottom:-9000px;}

Open in new window

3. Remove both of the .latestposts divs from the #main_content. This will actually hurt your equal height columns because it's adding stuff to the bottom outside of the actual "column" you want.
4. Add overflow:hidden to your #content
5. Remove height:auto from your columns and #content


The main caveat here is that your rounded corner on your right column is going to get lost.  Try the above and let us know.

0
 

Author Comment

by:ee-itpro
ID: 36531752
Thanks,  i'll try out the above stuff and let you people know how it goes
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Read about why website design really matters in today's demanding market.
This article discusses four methods for overlaying images in a container on a web page
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
In this tutorial viewers will learn how to embed custom externally-hosted Google Fonts using the Google Font API in CSS Go to the Google Fonts website at google.com/fonts: Browse or search based on font properties or name to find a suitable font for…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now