SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Hybrid View

  1. #1
    runat="server" Golgotha's Avatar
    Join Date
    Nov 2001
    Location
    Colorado
    Posts
    2,085
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Freeze Panes in tables?

    I'm trying to get freeze panes to work on a table; like Excel.

    Here's what I got just using CSS (scroll down to see the horizontal scrollbar):
    http://www.search-this.com/FreezePanes2.html

    I'm now thinking it's not possible just using CSS, think we need some JS...

    I'm only looking for the solution to work in Firefox.

    Here is a solution that works in IE:
    http://web.tampabay.rr.com/bmerkey/e...olumn-csv.html

    any ideas?

  2. #2
    The CSS Clinic is open silver trophybronze trophy
    Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    40,367
    Mentioned
    180 Post(s)
    Tagged
    6 Thread(s)
    Quote Originally Posted by mark
    Quote Originally Posted by mark
    Here is a solution that works in IE:

    Yes but that example is scripted using expressions which is a cheat. It's not a real css solution as it won't work with javascript disabled (and doesn't work in IE6 in standards mode either although I'm guessing it could be made to run).


    You can do anything you like with expressions as its just a means of scripting via css.

  3. #3
    I meant that to happen silver trophybronze trophy Raffles's Avatar
    Join Date
    Sep 2005
    Location
    Tanzania
    Posts
    4,662
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    I agree with Paul that expressions are a bad idea. They invalidate your CSS, are just javascript in a disgusting wrapper really, are refreshed whenever you do anything (like scroll, move mouse, etc.) and only work in one browser, so you might as well use proper javascript.

    Some results in google

    If it is the thead you are looking to fix, then you can give the tbody a size and overflow:auto plus some padding on the right to make space for the scrollbar. If it's a column or some other row in the tbody that you want to fix then you require something a bit trickier.

    Perhaps you could apply position:fixed to the row/column in question. It may well be that when this happens the cells stay where they are, then you actually won't require javascript at all. Otherwise, you would need to find out their scrollTop values and then apply position:fixed using those. You will then also need to give the table or tbody some margin to make up for the fixed cells being removed from the document flow.

  4. #4
    SitePoint Wizard
    Join Date
    Nov 2004
    Location
    Nelson BC
    Posts
    2,310
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I recall there being a big thread on how to freeze header rows/columns in tables but I can't get the sitepoint search working. Mike Foster wrote something that worked for one member, I think it was this:
    http://cross-browser.com/x/lib/view....bleHeaderFixed

    See if that does it for you.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •