Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   HTML (http://www.velocityreviews.com/forums/f31-html.html)
-   -   Synch two heights (http://www.velocityreviews.com/forums/t303688-synch-two-heights.html)

sfeher@gmail.com 07-12-2006 08:39 PM

Synch two heights
 
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.
http://groups.google.com/group/comp....a3a8e3e2ef47d0

A second question, not directly related to what I said so far is about
overflow.
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)

<html>
<head>
<style>
div
{
margin:0px;padding:0px;
}
.container
{
width:420px;
background:green;
}
.scrollbar
{
float:right; overflow:auto;
height:200px; width:16px;
background:orange;
}
.content
{
width:401px;
overflow-x:auto;
background:#f0f0c0;
}
.nowrap
{
white-space: nowrap;
width:700px;
}
</style>
</head>
<body>

<div class="container">
<div class="scrollbar"><div
style="height:1000px;background:red;"></div></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>
<div style="clear:both">
</div>
</body>
</html>

Regards,
Sebastian


Brian Cryer 07-13-2006 01:14 PM

Re: Synch two heights
 
<sfeher@gmail.com> wrote in message
news:1152736762.264617.200390@b28g2000cwb.googlegr oups.com...
> 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.
> http://groups.google.com/group/comp....a3a8e3e2ef47d0


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
www.cryer.co.uk/brian



Mark Eggers 07-13-2006 05:20 PM

Re: Synch two heights
 
sfeher@gmail.com wrote:
> 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.


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?

http://www.alistapart.com/articles/fauxcolumns/

/mde/
just some random thoughts . . . .


All times are GMT. The time now is 01:17 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.