Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / HTML, CSS, Scripts / CSS / September 2005



Tip: Looking for answers? Try searching our database.

Making two elements equal height (one of them floating)

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Andy Jeffries - 26 Sep 2005 16:25 GMT
Hi all,

I want to have two elements have an equal height, with that height being
the larger of the two (with dynamic content).  In one case they are just
side by side so I want them to look even and in another case I want a
border between them.

I originally tried to fudge this using Javascript (see my message below
which was posted in comp.lang.javascript) but the guys there suggested
there may be an easier way in pure CSS.

Can anyone give me a pointer in the right direction?

Cheers,

Andy

------------------------------------------------------------

I want to write a function that given two elements will make their
heights equal to the larger element.  I've had a go at it and it works,
but it makes both their heights larger than either of them (but equal)

The code is as follows:

var newheight = Math.max(second.offsetHeight, first.offsetHeight);
first.style.height = newheight + "px";
second.style.height = newheight + "px";

So, I'm obviously doing something stupid, but can anyone enlighten me? I
tried writing to offsetHeight but the changes seemed to be ignored.

Cheers,

Andy
Spartanicus - 26 Sep 2005 18:37 GMT
>I want to have two elements have an equal height, with that height being
>the larger of the two (with dynamic content).  In one case they are just
>side by side so I want them to look even and in another case I want a
>border between them.

That doesn't tell us much, what elements, what content, why, got an url?

Signature

Spartanicus

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.