Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6846277
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:36:06+00:00 2026-05-27T00:36:06+00:00

I am writing a page where I need an html table to maintain a

  • 0

I am writing a page where I need an html table to maintain a set size. I need the headers at the top of the table to stay there at all times but I also need the body of the table to scroll no matter how many rows are added to the table.

I want it to look like method 2 in this url: http://www.cssplay.co.uk/menu/tablescroll.html

I have tried doing this but no scrollbar appears:

tbody {
  height: 80em;
  overflow: scroll;
}
<table border=1 id="qandatbl" align="center">
  <tr>
    <th class="col1">Question No</th>
    <th class="col2">Option Type</th>
    <th class="col1">Duration</th>
  </tr>

  <tbody>
    <tr>
      <td class='qid'></td>
      <td class="options"></td>
      <td class="duration"></td>
    </tr>
  </tbody>
</table>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T00:36:07+00:00Added an answer on May 27, 2026 at 12:36 am

    Something like this?

    http://jsfiddle.net/TweNm/

    The idea is to wrap the <table> in a non-statically positioned <div> which has an overflow:auto CSS property. Then position the elements in the <thead> absolutely.

    #table-wrapper {
      position:relative;
    }
    #table-scroll {
      height:150px;
      overflow:auto;  
      margin-top:20px;
    }
    #table-wrapper table {
      width:100%;
    
    }
    #table-wrapper table * {
      background:yellow;
      color:black;
    }
    #table-wrapper table thead th .text {
      position:absolute;   
      top:-20px;
      z-index:2;
      height:20px;
      width:35%;
      border:1px solid red;
    }
    <div id="table-wrapper">
      <div id="table-scroll">
        <table>
            <thead>
                <tr>
                    <th><span class="text">A</span></th>
                    <th><span class="text">B</span></th>
                    <th><span class="text">C</span></th>
                </tr>
            </thead>
            <tbody>
              <tr> <td>1, 0</td> <td>2, 0</td> <td>3, 0</td> </tr>
              <tr> <td>1, 1</td> <td>2, 1</td> <td>3, 1</td> </tr>
              <tr> <td>1, 2</td> <td>2, 2</td> <td>3, 2</td> </tr>
              <tr> <td>1, 3</td> <td>2, 3</td> <td>3, 3</td> </tr>
              <tr> <td>1, 4</td> <td>2, 4</td> <td>3, 4</td> </tr>
              <tr> <td>1, 5</td> <td>2, 5</td> <td>3, 5</td> </tr>
              <tr> <td>1, 6</td> <td>2, 6</td> <td>3, 6</td> </tr>
              <tr> <td>1, 7</td> <td>2, 7</td> <td>3, 7</td> </tr>
              <tr> <td>1, 8</td> <td>2, 8</td> <td>3, 8</td> </tr>
              <tr> <td>1, 9</td> <td>2, 9</td> <td>3, 9</td> </tr>
              <tr> <td>1, 10</td> <td>2, 10</td> <td>3, 10</td> </tr>
              <!-- etc... -->
              <tr> <td>1, 99</td> <td>2, 99</td> <td>3, 99</td> </tr>
            </tbody>
        </table>
      </div>
    </div>
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am writing a diagnostic page for SiteScope and one area we need to
I'm writing code on the master page, and I need to know which child
I'm writing a simple AJAX call that returns a full HTML page and then
I'm writing a C# application that needs to generate an HTML page. Only parts
I am writing MVC listing page which need to bundle with dropdownlist. As I
I'm writing a userscript for a page which has this HTML code block.. <span
I'm writing a page that can use a couple of different themes, and I'm
I'm writing a page with several text fields and a drop down. The fields
I am writing a Page with XML Only. No XSL is being. everything is
Writing a JSP page, what exactly does the <c:out> do? I've noticed that the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.