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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T22:55:42+00:00 2026-06-05T22:55:42+00:00

I try to make a table header fixed when scoll down on pages. The

  • 0

I try to make a table header fixed when scoll down on pages. The problem is in IE7, the thead are not absolute but are showing in the “right” positions. It need to fly over the table. It works perfect in FireFox 11

I have a table structure as follow:

<span id="MyTable">
    <table border="0" cellpadding="2" cellspacing="2" width="100%">
    <thead class="tableFloatingHeader">
    <tr>
        <th>t</th>
        <th>t</th>
        <th>t</th>
        <th>t</th>
        <th>t</th>
        <th>t</th>
    </tr>
    <tr>
    <td><b>Total</b></td>
    <td></td>
    <td align="right"><b>2</b></td>
    <td align="right"><b>2</b></td>
    <td align="right"><b>2</b></td>
    <td align="right"><b>2</b></td>
    </tr>
    </thead>
<thead class="tableFloatingHeaderOriginal">
    <tr>
        <th>t</th>
        <th>t</th>
        <th>t</th>
        <th>t</th>
        <th>t</th>
        <th>t</th>
    </tr>
    <tr>
    <td><b>Total</b></td>
    <td></td>
    <td align="right"><b>2</b></td>
    <td align="right"><b>2</b></td>
    <td align="right"><b>2</b></td>
    <td align="right"><b>2</b></td>
    </tr>
    </thead>

CSS

.tableFloatingHeader {
    overflow: hidden;
    position: absolute;
    top: 0;
    display: none;
    left: auto;
    background-color: red;
}

JQuery

<script type="text/javascript">
        function UpdateTableHeaders() {
            $("div.divTableWithFloatingHeader").each(function() {
                var originalHeaderRow = $(".tableFloatingHeaderOriginal");
                var floatingHeaderRow = $(".tableFloatingHeader");
                var offset = $(this).offset();
                var scrollTop = $(window).scrollTop();
                if ((scrollTop > offset.top) && (scrollTop < offset.top + $(this).height())) {
                    floatingHeaderRow.css("display", "block");
                    floatingHeaderRow.css("top", Math.min(scrollTop - offset.top, $(this).height() - floatingHeaderRow.height()) + "px");

                    // Copy cell widths from original header
                    $("th", floatingHeaderRow).each(function(index) {
                        var cellWidth = $("th", originalHeaderRow).eq(index).css('width');
                        $(this).css('width', cellWidth);
                    });

                    // Copy row width from whole table
                    floatingHeaderRow.css("width", $(this).css("width"));
                }
                else {
                    floatingHeaderRow.css("display", "none");
                    floatingHeaderRow.css("top", "0px");
                }
            });
        }
        UpdateTableHeaders();
        $(window).scroll(UpdateTableHeaders);
        $(window).resize(UpdateTableHeaders);
    </script>
  • 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-06-05T22:55:43+00:00Added an answer on June 5, 2026 at 10:55 pm

    This may help you, basically add a conditional CSS expression style for IE7. I don’t like using expressions, but IE7 is another animal.

    thead tr {
         position: relative;
         top: expression(this.offsetParent.scrollTop);
        }
    

    http://geekswithblogs.net/LSheu/archive/2009/01/30/css-table-scrolling-with-fixed-header-for-ie-7.aspx

    Edit* Wrong URL

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

Sidebar

Related Questions

I try to make div class and style together, but somehow style is not
i have a problem,,i try to make a table using datatable...i've been download from
i want to calculating one row at table counter. i try to make my
I try to make this implementation of a multimap in C++, but I run
I try to make an animation with an image in my view but it
I try to make a PDF writing CSS and HTML but my CSS doesn't
I have a problem :-) I try to make a quick search with highlighting
i try make some parts of page with fixed style. I have similar HTML:
I try to retrieve the latest added bookingID from table booking but I do
I try to make function to check if table exists and to get total

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.