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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T10:13:41+00:00 2026-05-27T10:13:41+00:00

I want to make an html table with the top row frozen (so when

  • 0

I want to make an html table with the top row frozen (so when you scroll down vertically you can always see it).

Is there a clever way to make this happen without javascript?

Note that I do NOT need the left column frozen.

  • 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-27T10:13:42+00:00Added an answer on May 27, 2026 at 10:13 am

    This is called Fixed Header Scrolling. There are a number of documented approaches:

    http://www.imaputz.com/cssStuff/bigFourVersion.html

    You won’t effectively pull this off without JavaScript … especially if you want cross browser support.

    There are a number of gotchyas with any approach you take, especially concerning cross browser/version support.

    Edit:

    Even if it’s not the header you want to fix, but the first row of data, the concept is still the same. I wasn’t 100% which you were referring to.

    Additional thought
    I was tasked by my company to research a solution for this that could function in IE7+, Firefox, and Chrome.

    After many moons of searching, trying, and frustration it really boiled down to a fundamental problem. For the most part, in order to gain the fixed header, you need to implement fixed height/width columns because most solutions involve using two separate tables, one for the header which will float and stay in place over the second table that contains the data.

    //float this one right over second table
    <table>
      <tr>
        <th>Header 1</th>
        <th>Header 2</th>
      </tr>
    </table>
    
    <table>
    //Data
    </table>
    

    An alternative approach some try is utilize the tbody and thead tags but that is flawed too because IE will not allow you put a scrollbar on the tbody which means you can’t limit its height (so stupid IMO).

    <table>
      <thead style="do some stuff to fix its position">
      <tr>
        <th>Header 1</th>
        <th>Header 2</th>
      </tr>
      </thead>
      <tbody style="No scrolling allowed here!">
         Data here
      </tbody>
    </table>
    

    This approach has many issues such as ensures EXACT pixel widths because tables are so cute in that different browsers will allocate pixels differently based on calculations and you simply CANNOT (AFAIK) guarantee that the distribution will be perfect in all cases. It becomes glaringly obvious if you have borders within your table.

    I took a different approach and said screw tables since you can’t make this guarantee. I used divs to mimic tables. This also has issues of positioning the rows and columns (mainly because floating has issues, using in-line block won’t work for IE7, so it really left me with using absolute positioning to put them in their proper places).

    There is someone out there that made the Slick Grid which has a very similar approach to mine and you can use and a good (albeit complex) example for achieving this.

    https://github.com/6pac/SlickGrid/wiki

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

Sidebar

Related Questions

I want to know how I can make a row highlight using html, css,
I have a HTML table which I want to make fluid so that when
How can I make a div display over the top of a table tr,
I want to delete some data displayed in a HTML table row (first on
I want to make an HTML form with 2 select boxes. The selected option
So I want to make a HTML news letter to be sent out. I
I am traversing a HTML document using javascript DOM. I want make a list
I want to make a table in SqlServer that will add, on insert, a
I'm using an HTML table for a calendar and I want to fill the
I want to write reusable code that takes an HTML table from a JSP

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.