Jump to content

Fixed (table) header & footer, scrollable body.


trq

Recommended Posts

I've got this working perfectly in FF but the footer wont play nice in IE7 (which is my only target, this is an intranet application). The header is also working fine in IE7.

 

Example markup.

 

<div id="actual-list">
  <table>
    <thead>
      <tr>
        <td>Heading</td>
      <tr>
    </thead>
    <tbody>
      <tr>
        <td>Contents</td>
      <tr>
    </tbody>
    <tfoot>
      <tr>
        <td>Footer</td>
      <tr>
    </tfoot>
  </table>
</div>

 

Obviously, I have allot more columns and allot more rows.

 

The relevant CSS.

 

screen.css

#actual-list table{text-align:left;}
#actual-list table thead{background:#70b2e1;font-weight:bold;}
#actual-list table tbody{height:600px;overflow-y:auto;overflow-x:hidden;}/*see ie.css for ie fix*/
#actual-list table tfoot{background:#3383bb;font-weight:bold;}

 

ie.css (loaded only when IE is the client)

#actual-list{position:relative;height:600px;overflow-y:scroll;overflow-x:hidden;}
#actual-list table thead tr{position:absolute;padding:4px;top:expression(this.offsetParent.scrollTop);}
#actual-list table tbody{height:auto;padding:4px;}
#actual-list table tfoot tr{position:absolute;padding:4px;top:expression(this.offsetParent.scrollBottom);}

 

Presently the header is fixed, while both the tbody and tfooter moves when content overflows. I ideally need the footer to stay in a fixed position as well. This is indeed what happens when I use firefox.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.