Grow your CSS skills. Land your dream job.

position: fixed on a table row?

  • # March 12, 2009 at 9:58 am

    I want to make a table such that the heading row stays in place as you scroll, so you always know what information you’re looking at underneath. I tried setting "position: fixed" on the table row, but then the cells "collapse" (they shrink to just large enough to fit their text, no longer aligning with the rows underneath).

    Is there any good way to do this?

    # March 12, 2009 at 11:26 am

    This thing is awful and I hate looking at it now, but that’s what I was going for here:

    http://css-tricks.com/examples/WebsiteGalleryRoundup/

    The things is… it’s not really a table row up top it’s just an image. I’m not sure if table rows will respect fixed positioning. I assume they do not, they have their own special positioning rules. Likewise, you can’t adjust a cell with relative positioning (and stuff like that).

    # March 12, 2009 at 1:39 pm

    Yeah, that’s what I figured. When I set position: fixed it looks like it takes the row out of the normal "flow" of the table, and everything gets screwy (like the background color from the row underneath moves up behind the fixed row above it).

    I guess an image – or just a separate div rather than a table row – is the way to go.

    Rob
    # March 12, 2009 at 1:47 pm

    I’ve seen this done somewhere – let me have a look around :) *checks bookmarks…*

    AHH HA!

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

    Any good?

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".