Table that scrolls if too long BUT first row is static?

N

Noozer

I've got an ASP generated form that outputs the results to a table. The
table is contained within a DIV of a fixed height. This is to avoid a page
that is too long when there are a lot of results returned. This works fine,
except that the headings (first row in the table) scrolls with the rest of
the output.

Is there a simple way to keep this first row from scrolling?

The columns are not fixed widths since the data can vary greatly in size.
This means that I can't simply line up a set of headings above the scrolling
DIV.

Suggestions?
 
M

Mark Parnell

Previously in alt.html said:
I've got an ASP generated form that outputs the results to a table. The
table is contained within a DIV of a fixed height. This is to avoid a page
that is too long when there are a lot of results returned. This works fine,
except that the headings (first row in the table) scrolls with the rest of
the output.

Is there a simple way to keep this first row from scrolling?

I have seen it done before, but I don't have the URL.

OTTOMH: simplified version, untested:

thead {position: fixed;}

<table>
<thead>
<tr>
<th></th> etc.
</tr>
</thead>
<tbody>
<tr><td></td></tr> etc.
</tbody>

Won't work in IE, of course. :-( You may even be able to get rid of the
<div> and just add tbody {height: 20em; overflow: scroll;} to your CSS.
Again, not tested. :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top