Skeith
Skeith

Reputation: 2542

Matching two tables in HTML

I have a table that is filled with data from a database. When you scroll down though the headings are lost.

In order to solve this problem I made a second table above the first tables that held the headings. The headings are taken from the database with the data.

The problem is that the content in the second table changes the sizes of the fields so the headings in the first table no longer line up properly.

Does anyone know how I can make the first table copy the second tables field sizes.

I am editing my predecessors code which is a .jsp file which I am told is a form of Java.

Upvotes: 0

Views: 296

Answers (2)

Skeith
Skeith

Reputation: 2542

I decided to make each of the columns a fixed width. not the best solution but since it is an in house application It will do.

Upvotes: 0

Pekka
Pekka

Reputation: 449525

This is not possible in pure HTML: You would have to use JavaScript to match the cell sizes.

However, there are better approaches to your problem. See this question for an overview:

HTML table with fixed headers?

here is a CSS only approach that looks nice.

Upvotes: 1

Related Questions