www.webdeveloper.com
Results 1 to 4 of 4

Thread: table height

  1. #1
    Join Date
    Nov 2002
    Posts
    421

    table height

    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?

  2. #2
    Join Date
    Nov 2002
    Posts
    984
    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>

  3. #3
    Join Date
    Nov 2002
    Posts
    421
    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.

  4. #4
    Join Date
    Nov 2002
    Posts
    984
    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.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles