This is Interesting: Free Magazines for Graphics designers and webmasters
Home > Archive > Stylesheets > July 2007 > Adjusting Div's Width
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Adjusting Div's Width
|
|
| vunet.us@gmail.com 2007-07-20, 6:17 pm |
| Hello,
I use a floating div with overflow:auto properties for specific reason
(to avoid the bug of overlapping elements https://bugzilla.mozilla.org/attachment.cgi?id=125003).
Anyway, the problem is
that this div has 2 tables inside. In some rare cases, tables may have
larger width than my floating div, which is the container for these
tables, and therefore, scrollbars appear.
I need to remove scrollbars, so I created function to get each tables
clientWidth (I also tried offsetWidth) values and if any table is
larger than its container,
I apply the larger width to the container too.
The problem begins with browser's incompatibility. Sometimes, it still
does not work right. So I am looking for the better solution.
Could you please recommend how I can determine if any tables is larger
than their container and adjust the container (my floating div) to
avoid scrollbars? I'd
really appreciate your suggestions.
Thanks.
| |
|
| On 2007-07-20, vunet.us@XXXXXXXXXX <vunet.us@XXXXXXXXXX> wrote:
> Hello,
> I use a floating div with overflow:auto properties for specific reason
> (to avoid the bug of overlapping elements https://bugzilla.mozilla.org/attachment.cgi?id=125003).
> Anyway, the problem is
> that this div has 2 tables inside. In some rare cases, tables may have
> larger width than my floating div, which is the container for these
> tables, and therefore, scrollbars appear.
> I need to remove scrollbars, so I created function to get each tables
> clientWidth (I also tried offsetWidth) values and if any table is
> larger than its container,
> I apply the larger width to the container too.
> The problem begins with browser's incompatibility. Sometimes, it still
> does not work right. So I am looking for the better solution.
> Could you please recommend how I can determine if any tables is larger
> than their container and adjust the container (my floating div) to
> avoid scrollbars? I'd
> really appreciate your suggestions.
You probably don't need to resort to JavaScript at all. If you just make
the container width: auto then it will get the width of the wider of the
two tables automatically.
|
|
|
| | Copyright 2003 - 2008 forum4designers.com Software forum Computer Hardware reviews |
|