@tryin_to_learn posted a new topic, subject "Freeze table headers pure CSS?". It read:

   I have large, dynamically driven tables with columns of varying widths. I was hoping to find a pure CSS way to implement this but so far all I've found are solutions for tables with fixed column widths. Is there a way to freeze table headers when you have tables with variable width columns?
      *[GUI]: Graphical User Interface

@RyanReese replied

    Here you go.
    
    We had a quiz on this not too long ago.
      *[GUI]: Graphical User Interface

To which @tryin_to_learn replied

    Excellent quiz! Is there a solution that doesn't require a fixed table height? What I'm hoping for is to allow the table to extend however far it needs to but to be able to scroll while keeping the header in place. I don't really need a footer.
      *[GUI]: Graphical User Interface

Then @RyanReese said

    Then don't put a footer in there. And you don't want a height…but when do you want scrolling…?
      *[GUI]: Graphical User Interface

So @tryin_to_learn replied

    Just regular page scrolling. There's a js example here but was hoping to to it without js:
    
    http://cross-browser.com/x/examples/xthf.html
    
    The problem is that I'm building an application for many users so the table lengths may vary widely. Some users may only have 2 or 3 rows in a table - others may have several hundred. I'm trying to find a fix that won't affect the look of the page for users with only a few rows, but that will kick in the header freeze for longer tables. I'm open to other ideas.
      *[GUI]: Graphical User Interface

Then @RyanReese said

    In Opera it is glitchy a little bit. And no as far as I know there are no ways.
      *[GUI]: Graphical User Interface

To which @tryin_to_learn replied

    Ok, thanks. I may end up using the one above - just need to play with it a bit in my head.
      *[GUI]: Graphical User Interface

@tryin_to_learn replied

    Probably a dumb question but I assume there's no way to add a min-height kind of thing so I could set the table at 6 or 7 rows for the default and then have it stretch for users with more data?
      *[GUI]: Graphical User Interface

So @RyanReese replied

    min-height wil still allow for expansion and thus you will have to set a max-height in conjunction with that to stop it at a certain point to allow the scrollbars to take effect.
    
    You will need an expression for IE6 though.
      *[GUI]: Graphical User Interface

To which @tryin_to_learn replied

    Ok - well, that would take care of some of my reservations. What's the IE6 fix for that?
      *[GUI]: Graphical User Interface

@RyanReese replied

    What's the IE6 fix for what?
      *[GUI]: Graphical User Interface

To which @tryin_to_learn replied

    You said that I'd need an expression for IE6 - wasn't sure what you meant.
      *[GUI]: Graphical User Interface

Then @RyanReese said

    Yes you need an expression for max-height. View the FAQs at the top of this thread on how t odo that. Or just google “IE6 max-height expression”. There are many articles on this.
      *[GUI]: Graphical User Interface

Then @system said

    *[GUI]: Graphical User Interface


{'source': 'discourse', 'url': 'https://www.sitepoint.com/community/t/freeze-table-headers-pure-css/5217', 'title': 'Freeze table headers pure CSS?', 'views': 2612, 'has_accepted_answer': False, 'word_count': 464, 'like_count': 0, 'reply_count': 6, 'participant_count': 2, 'posts': 14, 'tags': '', 'author': '@tryin_to_learn', 'participants': '@tryin_to_learn, @RyanReese, @system', 'image_url': [None], 'created_at': '2009-07-04T14:51:38.000Z', 'last_posted_at': '2014-10-08T00:52:53.779Z'}