wood burning stoves 2.0*
The moose likes HTML, CSS and JavaScript and the fly likes DIV overflow inside TABLE Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "DIV overflow inside TABLE" Watch "DIV overflow inside TABLE" New topic
Author

DIV overflow inside TABLE

Alex Anderson
Greenhorn

Joined: Dec 06, 2005
Posts: 10
Hi,

i have a problem with getting a DIV to overflow inside a TABLE.
The code below does not scroll the table cell, but instead the whole screen is scrolled.

Is it possible to make the table 100% in width and height (of the browser window), and then just make the cell with the div tag scroll??





[ December 15, 2005: Message edited by: Alex Anderson ]
[ December 15, 2005: Message edited by: Alex Anderson ]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60739
    
  65

Not something I've played much with, but I believe you may have to specify dimensions for the div to trigger the desired behavior. But that's just a guess.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Alex Anderson
Greenhorn

Joined: Dec 06, 2005
Posts: 10
A specific height is just what i don't want to specify.

If i put a height in the style tag like


it works partially, but then i don't get the dynamics I want. I want the table to take 100% in height and width of the browser window.
[ December 15, 2005: Message edited by: Alex Anderson ]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60739
    
  65

I'd try dimensions of 100% which should scale the div to the size of its containing cell.
Alex Anderson
Greenhorn

Joined: Dec 06, 2005
Posts: 10
I agree with you that sounds lika a decent solution, but unfortunately that doesn't work.
Alex Anderson
Greenhorn

Joined: Dec 06, 2005
Posts: 10
Got it working with some javascript. But i really don't want to use javascript here.. should be a better solution to this.


(some spaces added to make the forum post to work)
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60739
    
  65

Works as expected in Safari, but not Firefox. Can't speak for IE.
Alex Anderson
Greenhorn

Joined: Dec 06, 2005
Posts: 10
Thanks for trying it!
Did some changes so now it works in Explorer, Netscape, Firefox and Opera atleast.


(remove spaces to if you want to try it)

Reused code from this page: http://www.quirksmode.org/js/winprop.html

[ December 16, 2005: Message edited by: Alex Anderson ]
[ December 16, 2005: Message edited by: Alex Anderson ]
Rob Hunter
Ranch Hand

Joined: Apr 09, 2002
Posts: 815
Don't know if I'm fully understanding this or not but why set the td tag's width property to 100% and the height to a 100%? What happens if you left out the width specification and specified the third TD tag's width and set the closing TR tag to 100%? When you say it scrolls thwe whole page, is it scrolling the whole page both vertically and horizontally? Just curious is all. I've used DIV's tags in the recent past with tables as well as includng scriptlets like you are and found out a few things about it as well.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: DIV overflow inside TABLE
 
Similar Threads
Getting search results on same search page
Scroll of div fail to work when table row inside it is higlighted
Table with Scrollbar
Creating CSS class at runtime
Table scrolling problems