Click to See Complete Forum and Search --> : table height
Beach Bum
11-27-2002, 02:41 PM
i have a table - say 200px in height
i want it to be only 100px high - and therefore scrollable.
i have tried the height attribute. i have tried style/height attribute. nothing works. the table always draws 200px high.
how can i scale down a table height to force it to be scrolled at a shorter height?
Stefan
11-27-2002, 02:59 PM
According to spec <table> is deliberately allowed to outright ignore any height & width constriction you try to put on it if it makes the content not fit.
If you are abusing <table> for creating general layout, you just found a very good reason to stop.
If not (and you are really working with a table) you will have to put the table inside some container and make it scollable.
In short the fix for both things is to use proper markup+CSS. :)
A hint in the right direction (since you don't give an url to your page) is to use something like.
<div style="overflow:auto; height:100px;">
your content
</div>
Beach Bum
11-27-2002, 04:43 PM
guilty - trying to see if i could use a table to get around a problem. i am using this for a scrollable box of text
<span style="text-align:left; overflow:auto; border-style:inset; width:480px; height:300px;">
. . . bunch of <p></p> text lines . . .
</span>
works great in IE6
but NS7 just ignores it and lets the text within the span just flow on the page (i also tried the div tag). so i was trying to find something that might work for both browsers. guess NS users will just get an ugly page.
maybe someday we will get some consistency around the web. i suppose that is one plus for MS - at least we have 90% coverage if the page looks right in IE.
Stefan
11-27-2002, 11:31 PM
Originally posted by Beach Bum
<span style="text-align:left; overflow:auto; border-style:inset; width:480px; height:300px;">
. . . bunch of <p></p> text lines . . .
</span>
Hmm, that is obviously wrong since you are trying to place a block-level <p> inside an inline-level <span>, whitch is not allowed (and it won't pass through the validator at http://validator.w3.org).
However if you use a <div> insted of <span> it should work.
Could you post an URL or attach the code you have, becuse there must be something else broken on the page if you can't get it to work with <div> in NS 7.