Getting vertical scroll bar in a table cell

Discussion in 'HTML' started by Tim Streater, Apr 23, 2014.

  1. Tim Streater

    Tim Streater Guest

    It would seem that, if I have content in a table cell that is too tall
    for the cell, the only way I can get a vertical scroll bar in the cell
    is to put a <div> in the cell, and put the content in that.

    It also looks like I then have to explicitly set the height of the
    <div> to any old value, whereupon the scroll bar appears, is the height
    of the cell, and correctly scrolls the content.

    Is there some logic to this, and if so what is it?

    --
    "If you're not able to ask questions and deal with the answers without feeling
    that someone has called your intelligence or competence into question, don't
    ask questions on Usenet where the answers won't be carefully tailored to avoid
    tripping your hair-trigger insecurities." - D M Procida, UCSM
    Tim Streater, Apr 23, 2014
    #1
    1. Advertising

  2. Tim Streater

    richard Guest

    On Wed, 23 Apr 2014 19:41:01 +0100, Tim Streater wrote:

    > It would seem that, if I have content in a table cell that is too tall
    > for the cell, the only way I can get a vertical scroll bar in the cell
    > is to put a <div> in the cell, and put the content in that.
    >
    > It also looks like I then have to explicitly set the height of the
    > <div> to any old value, whereupon the scroll bar appears, is the height
    > of the cell, and correctly scrolls the content.
    >
    > Is there some logic to this, and if so what is it?


    because table cells natively expand with content size and so do all of the
    cells within that row.
    In order to maintain the cell size as you want it, you must therefor use a
    division so you can get the scrollbar.
    richard, Apr 23, 2014
    #2
    1. Advertising

  3. Tim Streater

    dorayme Guest

    In article <230420141941019334%>,
    Tim Streater <> wrote:

    > It would seem that, if I have content in a table cell that is too tall
    > for the cell, the only way I can get a vertical scroll bar in the cell
    > is to put a <div> in the cell, and put the content in that.
    >


    If the content is "too tall" for the cell then you already must have a
    height restriction on the table or the row or the cell, because table
    cells normally shrink or expand to fit. And for obvious reasons, the
    cells in any one row are the same height. If you put a height
    restriction on the cell, the content will simply overflow. Styling a
    cell directly with an overflow: auto or scroll (in addition to the
    height - without a height the *table* just gains height to
    accommodate) does not work. It is a good question as to why it could
    not have been otherwise - that is, just height and overflow: auto or
    scroll on the cell directly.

    One normally works this with an inner DIV (as you are doing) and
    styling this.


    > It also looks like I then have to explicitly set the height of the
    > <div> to any old value, whereupon the scroll bar appears, is the height
    > of the cell, and correctly scrolls the content.
    >


    Why to any old value? What is the context? What is causing the height
    restriction, you talking viewport height of a user? If so, the
    scrollbars should appear fine on the table itself.


    > Is there some logic to this, and if so what is it?


    --
    dorayme
    dorayme, Apr 23, 2014
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Framework fan
    Replies:
    2
    Views:
    9,163
    Framework fan
    Dec 2, 2003
  2. bienwell
    Replies:
    8
    Views:
    13,961
    vabraham
    Dec 7, 2011
  3. Guy
    Replies:
    1
    Views:
    38,041
  4. David Pratt
    Replies:
    0
    Views:
    478
    David Pratt
    Jun 28, 2005
  5. A Web Master

    Vertical scroll bar in a table <TD> possible ?

    A Web Master, Jan 27, 2004, in forum: ASP General
    Replies:
    4
    Views:
    375
    Bob Barrows
    Jan 27, 2004
Loading...

Share This Page