Andy Baker
Andy Baker

Reputation: 21587

How to create a 100% width table that shows scrollbars on itself rather than on the document

If I use a fixed width and overflow: auto then I can get scrollbars but I can't use the available width of the screen.

If I use no width then the table uses all available width but forces the document itself to have scrollbars when the browser window is too narrow.

How can I get the best of both worlds? Is there a non-javascript solution?

PS Did I mention this needs to work in IE6 too? :-)

To clarify: The table is 100% the width of it's container (in this case a table cell but don't worry - I've got an official permit) rather than 100% of the browser width. I want it to have fluid width and height but if the browser window is too narrow to contain it I want the table to have scrollbars rather than the document.

Upvotes: 0

Views: 158

Answers (1)

nonopolarity
nonopolarity

Reputation: 151196

you can try using a div, with a height, and put the table inside that div. that div will have overflow: auto.

Upvotes: 1

Related Questions