Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

scrolling table rows except top row...

Status
Not open for further replies.

fdgsogc

Vendor
Feb 26, 2004
160
CA
Challenge:
Use div tag with overflow:auto to create scroll bar for a table. However, need the first row (column headers) outside of the scrolling section.

Problem:
Initially, I had the div tag around the table
Code:
<div style="overflow:auto;height:300">
<table>
<tr><td>[b]Row with headings[/b]</td></tr>
<tr><td>2nd row</td></tr>
<tr><td>3rd row</td></tr>
etc...
<tr><td>20th row</td></tr>
</table>
</div>

This works as far as scrolling goes. However, it also scrolls the first row which contains my column headers.

I would like to use a div tag inside the table tag to keep the first row out. However, I get erratic results when I do this.

I do not want to put the column header row in a separate table outside of the div tag because then I have column width issues. The column header table and the data table column widths never line up without a lot of difficulty.

Ideas?
 
Thanks Vragabond. This is the link that really helped my out ( In fact, I do need to put the header in its own table inside a div tag. But if I set the table style for my data table like so:
Code:
style="table-layout: fixed"

I forces the width of all columns to equal the width of the first row (my header row). Then all you have to do is hide the header row in the data column with this code:
Code:
<thead style="display: none">

Thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top