-
[CSS] Table width
Hi all,
I must have had a cerebral injection of curry or something because today has been one massive brain fart. Anyway, the situation is thus. I have a humungous HTML table that extends off the screen in about 15 dimensions, and naturally I would like to constrain it somewhat. Applying height to the tbody works, but I cannot seem to get the thing to be 100% width (i.e. fitting within the viewport).
What I eventually want to do is scroll, in both directions, within the tbody, whilst the whole table fits within the screen. The only problem is width-wise it refuses to play ball. Possibly it is spite, but I am hoping there is simply something I'm missing. Any thoughts?
Cheers
- P
-
Re: [CSS] Table width
Take a look at this: http://adam.codedv.com/examples/table_width.html
The trick is to turn the table and the tbody elements into block elements. Block elements, unlike inline elements respond to width constraints.
-
Re: [CSS] Table width
Thanks! I didn't know that.
But, surprise surprise, it doesn't work in IE.
Could it be that IE does not recognise the overflow property on tables?
-
Re: [CSS] Table width
Have another look. If you don't mind putting the table in a div, you can use that to enforce the width.