SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Addict
    Join Date
    Jul 2005
    Posts
    215
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Put Scrollbar in the Table

    Hi All,
    I like to display scrollbar on my table, can I do it with simple HTML code and not have to add javascripts???

    Here are my Code:
    PHP Code:
    <html>
    <
    body>
    <
    table width="500"  height="100" border="2" scrollbars="yes">
       <
    tr>
          <
    td>
             
    HELLO THERE<br>
             
    HELLO THERE<br>
          </
    td>
       </
    tr>
    </
    table>
    </
    body>
    </
    html

  2. #2
    SitePoint Wizard Pepejeria's Avatar
    Join Date
    Jan 2005
    Location
    Too far up north
    Posts
    1,566
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Just wrap your table in a div with overflow set to auto and a defined height:
    Code:
    <div style="overflow:auto;height:40px;">
    <table>
    <tr>
    ... and so on
    </div>

  3. #3
    SitePoint Addict
    Join Date
    Jul 2005
    Posts
    215
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank You So Much, I got it working with following Code, though I will use your code, its short so I can include it into my PHP pages without having Class in the <Head> Section:

    My Code with DIV Tag & CSS Style:
    PHP Code:
    <html>
    <
    head>
    <
    style type="text/css">    
       .
    scrollcell {
          
    overflowauto;
          
    height100px;
       }
    </
    style>
    </
    head>

    <
    body>
    <
    table width="500"  height="250" border="1">
       <
    tr><td>
          
    HELLO THERE<br>
          
    HELLO THERE<br>
       </
    td></tr>
       <
    tr><td><div class="scrollcell">
          
    HELLO THERE<br>
          
    HELLO THERE<br>
          
    HELLO THERE<br>
          
    HELLO THERE<br>
          
    HELLO THERE<br>
          
    HELLO THERE<br>
       </
    div></td></tr>  
    </
    table>    
    </
    body>
    </
    html


Bookmarks

Posting Permissions

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