468,119 Members | 1,683 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,119 developers. It's quick & easy.

Adjusting Div's Width

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.

Jul 20 '07 #1
1 4017
On 2007-07-20, vu******@gmail.com <vu******@gmail.comwrote:
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.
Jul 21 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

14 posts views Thread by mistral | last post: by
1 post views Thread by vunet.us | last post: by
div
3 posts views Thread by shalini166 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.