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 4538266
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T14:47:19+00:00 2026-05-21T14:47:19+00:00

This has been asked a zillion times: here , there , and the other

  • 0

This has been asked a zillion times: here, there, and the other place just on SO. Yet there’s no real good answer that I can find.

<recap> Often I have tables that are vertically much deeper than the viewport. I’d like to be able to scroll the table’s <tbody> while its <thead> remains fixed and visible. Some of these tables are also much wider than the viewport. Here I want the table’s <thead> to scroll horizontally.

To get the effect, I have dozens of lines of JS, including setInterval( ) calls to check scrollLeft and scrollTop, so that I can reposition a copy of <thead>1. It works but it’s a huge, ungainly, frail and unmaintainable pain in the ass.</recap>

Question: Is there some straightforward css3 way, existent or emerging or proposed, that I can use to get a a table’s <thead> and <tbody> to scroll horizontally and vertically, yet independently of each other?
Thanks!


1 Why setInterval( )? Because IE doesn’t uniformly deliver onScroll events, you silly; everybody knows that!

  • 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-21T14:47:20+00:00Added an answer on May 21, 2026 at 2:47 pm

    a dirty way would be to put the header table in a separate div like:

    <div class="header">
    <table>
        <thead><tr><td>#</td><td>v</td></tr></thead>
    </table>
    </div>
    

    Then body in the another div like:

    <div class="body">
        <table>
            <tbody>
                <tr><td>1</td><td>a</td></tr>
                <tr><td>1</td><td>a</td></tr>
                <tr><td>1</td><td>a</td></tr>
                <tr><td>1</td><td>a</td></tr>
                <tr><td>1</td><td>a</td></tr>         
        </tbody>
    </table> 
    </div>
    

    Now you can give a fixed height to body div and set oveflow to auto. like:

    table{border:0px solid #ccc;height:30px;}
    table tr td{border:1px solid #ccc;padding:5px;}
    div.body{height:70px;overflow:auto;border-bottom:1px solid #ccc;}
    

    here is a working example I did in jsfiddle

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This has been asked multiple times here, but without a solid and understandable answer.
I know this question has been asked a zillion times, but I still feel
I have no doubt this has been asked and answered here a dozen times,
I know this has been asked many times, but I cant find answer to
This has been asked numerous times here on SO. But I haven't found a
This has been asked a dozen times already, but the answer is always see
I know this has been asked at least a thousand times but I can't
Sorry if this has been asked before, but I couldn't find a good example
This has been asked several times for several languages but I can't get it
I know this has been asked around, but couldn't find a straight answer. My

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.