table height

liunx

Guest
i have a table - say 200px in height<br />
<br />
i want it to be only 100px high - and therefore scrollable.<br />
<br />
i have tried the height attribute. i have tried style/height attribute. nothing works. the table always draws 200px high.<br />
<br />
how can i scale down a table height to force it to be scrolled at a shorter height?<!--content-->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.<br />
<br />
If you are abusing <table> for creating general layout, you just found a very good reason to stop.<br />
<br />
If not (and you are really working with a table) you will have to put the table inside some container and make it scollable.<br />
<br />
In short the fix for both things is to use proper markup+CSS. :)<br />
<br />
A hint in the right direction (since you don't give an url to your page) is to use something like.<br />
<br />
<div style="overflow:auto; height:100px;"><br />
your content<br />
</div><!--content-->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<br />
<br />
<span style="text-align:left; overflow:auto; border-style:inset; width:480px; height:300px;"><br />
. . . bunch of <p></p> text lines . . .<br />
</span><br />
<br />
works great in IE6<br />
<br />
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.<br />
<br />
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.<!--content-->Originally posted by Beach Bum <br />
<br />
<span style="text-align:left; overflow:auto; border-style:inset; width:480px; height:300px;"><br />
. . . bunch of <p></p> text lines . . .<br />
</span><br />
<br />
<br />
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 <!-- m --><a class="postlink" href="http://validator.w3.org">http://validator.w3.org</a><!-- m -->).<br />
<br />
However if you use a <div> insted of <span> it should work.<br />
<br />
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.<!--content-->
 
Back
Top