Reputation: 21
I have a HTML table which was built using https://github.com/cemerick/jsdifflib that compares two different text files.
Some of the lines of the different files I'm comparing can be quite long. What I'm trying to achieve is a horizontal scroll bar for the text columns while the line numbers columns stay fixed.
Illustration:
| 1 | X | 1 | Y |
| 2 | X | 2 | Y |
| 3 | X | 3 | Y |
| 4 | X | 4 | Y |
| 5 | X | 5 | Y |
The 1st and 3rd columns contain the lines numbers, these columns contain th elements and need to stay fixed.
The 2nd and 4th columns contain the files lines, these lines contain td elements and can be quite long so I would like to keep each of these two columns in a fixed width with a horizontal scroll bar.
Is it possible to achieve that using an HTML single table element?
Upvotes: 2
Views: 98
Reputation: 343
Hate to break it to ya, but unless I'm misunderstanding you, you can't achieve that with only one table
element.
Tables are based on the premise that the cells in each row are perfectly aligned with the cells directly above it. You could do something like this, but it would be far more complex than a single table
element.
Upvotes: 1