Synch two heights

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
Hi All,

I am having trouble big times figuring out a way of forcing a DIV to be
in synch with another DIV's height in a (mostly vertically) fluid
layout in a web app context. The first one has overflow-x:auto; and a
width set but not a height as I want it to vertically grow with the
text inside.

Basically I would like the same height for the second one. I care less
if it is CSS, tables or Javascript but I would prefer the solution to
work on both IE6 & FF1.5.

Trying to fix the height with Javascript works ok except when font size
changes and the heights go out of sync. I found little information on
how to handle this case.

A second question, not directly related to what I said so far is about
Is there any way of enforcing overflow:auto in IE without having to
specify exactly width/height - e.g. use the parents height
(width:100%)? This would fix all my problems including the one from my
first question.

Here's a stripped down version of my code: (it's for a virtual grid
where the the vertical scrolling is faked and the content of the
control gets replaced real-time)

        float:right; overflow:auto;
        height:200px; width:16px;
        white-space: nowrap;

<div class="container">
    <div class="scrollbar"><div
    <div class="content">
        <div class="nowrap">Row1</div>
        <div class="nowrap">Row2</div>
        <div class="nowrap" style="text-align:right">Row3</div>
        <div class="nowrap">Row4</div>
        <div class="nowrap">Row5</div>
        <div class="nowrap">Row6</div>
        <div class="nowrap">Row7</div>
    <div style="clear:both">


Re: Synch two heights

Quoted text here. Click to load it

I hate to say it, but you could try using a table rather than div's. A table
with one row and two columns will automatically have both cells the same
height. Of course if you want both to be the same height and yet one under
the other then tables won't help.

Brian Cryer

Re: Synch two heights wrote:
Quoted text here. Click to load it

Hard to tell what you want without a url or at least a graphic markup
of what you want.

However, does the following article match your needs? /

just some random thoughts . . . .

Site Timeline