Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Scrollable div in <td> not work in firefox 1

Status
Not open for further replies.

Badgers

Programmer
Nov 20, 2001
187
US
Help,

I have a page like :

100% height and width 100%
----outer table----------
- -
-------------------------
-<td>
- <div height 100% and scroll within td>
-</td>
-
-------------------------

The problem I want to div to scroll within the div and automatically resize with the browser. This works fine in IE but not in netscape.

Here is the code: any help would be great


<table height="100%" width="100%" border="1">
<tbody>
<tr height="200">
<td> and stuff</td>
</tr>
<tr>
<td>
<div style="width:100px; height:100%; background-color:#cccccc; overflow:scroll;">
1<br />2<br />1<br />2<br />1<br />2<br />1<br />2<br />1<br />2<br />1<br />2<br />1<br />2<br />1<br />2<br />1<br />2<br />
1<br />2<br />1<br />2<br />1<br />2<br />1<br />2<br />1<br />2<br />1<br />2<br />1<br />2<br />1<br />2<br />1<br />2<br />
1<br />2<br />1<br />2<br />1<br />2<br />1<br />2<br />1<br />2<br />1<br />2<br />1<br />2<br />1<br />2<br />1<br />2<br />

</div>
</td>
</tr>
</tbody>
</table>

Thanks
 
What is this obsession with reinventing the scrollbars? If you use 100% of width and 100% of height, isn't that a browser window? And isn't it true that you could achieve the same effect with no code at all?
 
Code:
<style>
.scrollable {
width: 100%;
height: 390px;
overflow: auto;
}
</style>

then set the class of your TD to .scrollable.

I think that should give you what you want.

Rob
 
Thanks for your interesting comment I am not trying to re-invent anything.

What I am trying to do is :

1. Have a table 100% in width and height
2. Within a td have a div with will resize to the height of the td and scroll.

This will enable when the browser is reiszed, the div will resize to the height and width of the td and scroll as needed.

 
Cheers Rob, the problem with that I want to height to be 100%, refer to the bit above.

Cheers
 
First of all, is your table 100% high in FF anyway? Because without some tinkering, 100% height is not that easy to achieve. What doctype are you using on the page? I still think you are trying to reinvent things -- if nothing else frames, which are really not worth reinventing. With your counter-intuitive design you also have to understand that mouse scrolling in Geckos will not be an option, since they do not support mouse scrolling on scrollable divs.

I would still suggest you just use regular page stuff. If you want the header to remain on your page at all times, look into fixed positioning in standard compliant browsers and some JS tinkering in IE.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top