Getting a div to fill a table cell

Discussion in 'HTML' started by Chris, Aug 18, 2004.

  1. Chris

    Chris Guest

    I've got a block of content that I'd like to put in a scrolling div within a
    table cell. The reason is that there are menus and other parts of the page
    that must appear around the content, so the boundaries of the content must
    remain on the visible part of the page.

    The problem is that I can't figure out how to get the div to confine itself
    to the available space within the cell. View this page to see what I mean:
    http://69.13.118.195/test.html

    If you're using IE, the content extends off the right edge of the page,
    instead of staying in the cell. If you're using Mozilla or Firefox, the
    content is the right width, but it extends off the bottom of the page.

    How can I get all the content to stay in the cell, with scrollbars available
    to see the rest of it? I'm even willing to use a little Javascript if that
    will solve the problem.


    Here's the page, just in case the server above isn't available:

    <html>
    <table width=90% border="1" height="90%">
    <tr>
    <td>left</td>
    <td><div style="border: 1px solid black; overflow: auto; height:100%;
    width:100%">
    <pre>
    really wide content here really wide content here really wide content here
    really wide content here really wide content here really wide content here
    really wide content here really wide content here really wide content here
    more content
    more content
    more content
    more content
    more content
    more content
    more content
    more content
    more content
    more content
    more content
    more content
    more content
    more content
    more content
    more content
    more content
    more content
    more content
    more content
    more content
    </pre>
    </div></td>
    </tr>
    </html>
    Chris, Aug 18, 2004
    #1
    1. Advertising

  2. Chris

    v8mirage Guest

    How about <iframe>?? I had the same problem before and solved with iframe.


    Cheers,
    v8mirage

    Chris wrote:
    > I've got a block of content that I'd like to put in a scrolling div within a
    > table cell. The reason is that there are menus and other parts of the page
    > that must appear around the content, so the boundaries of the content must
    > remain on the visible part of the page.
    >
    > The problem is that I can't figure out how to get the div to confine itself
    > to the available space within the cell. View this page to see what I mean:
    > http://69.13.118.195/test.html
    >
    > If you're using IE, the content extends off the right edge of the page,
    > instead of staying in the cell. If you're using Mozilla or Firefox, the
    > content is the right width, but it extends off the bottom of the page.
    >
    > How can I get all the content to stay in the cell, with scrollbars available
    > to see the rest of it? I'm even willing to use a little Javascript if that
    > will solve the problem.
    >
    >
    > Here's the page, just in case the server above isn't available:
    >
    > <html>
    > <table width=90% border="1" height="90%">
    > <tr>
    > <td>left</td>
    > <td><div style="border: 1px solid black; overflow: auto; height:100%;
    > width:100%">
    > <pre>
    > really wide content here really wide content here really wide content here
    > really wide content here really wide content here really wide content here
    > really wide content here really wide content here really wide content here
    > more content
    > more content
    > more content
    > more content
    > more content
    > more content
    > more content
    > more content
    > more content
    > more content
    > more content
    > more content
    > more content
    > more content
    > more content
    > more content
    > more content
    > more content
    > more content
    > more content
    > more content
    > </pre>
    > </div></td>
    > </tr>
    > </html>
    >
    >
    v8mirage, Aug 18, 2004
    #2
    1. Advertising

  3. Chris wrote:
    > I've got a block of content that I'd like to put in a scrolling div
    > within a table cell. The reason is that there are menus and other
    > parts of the page that must appear around the content, so the
    > boundaries of the content must remain on the visible part of the page.


    rip out the "<pre>"?
    use <p> for new paragraphs?
    use <br> for breaks where they are needed?

    or..... is this a helpful....?

    <html>
    <div style="margin:35px;border: 1px solid black; overflow: auto; height:90%;
    width:90%">
    <p>really wide cont......here</p>
    <p>more content</p>
    <p>more content</p>
    </div>
    </html>
    Disco Octopus, Aug 18, 2004
    #3
  4. Chris

    Neal Guest

    On Wed, 18 Aug 2004 11:23:36 +1000, v8mirage <> wrote:

    > How about <iframe>?? I had the same problem before and solved with
    > iframe.



    That's like solving a headache with a guillotine. Please...
    Neal, Aug 18, 2004
    #4
    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. Phillip Roncoroni
    Replies:
    14
    Views:
    1,089
    Toby A Inkster
    Apr 5, 2004
  2. Water Cooler v2
    Replies:
    3
    Views:
    36,912
    Water Cooler v2
    Jul 12, 2006
  3. RSH
    Replies:
    0
    Views:
    534
  4. sdf
    Replies:
    3
    Views:
    1,903
  5. Water Cooler v2
    Replies:
    1
    Views:
    167
    David Dorward
    Jul 12, 2006
Loading...

Share This Page