File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes HTML, CSS and JavaScript and the fly likes Align Two Tables Vertically Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Align Two Tables Vertically" Watch "Align Two Tables Vertically" New topic

Align Two Tables Vertically

Steve Dyke
Ranch Hand

Joined: Nov 16, 2004
Posts: 1559
I have two tables which was originally one. But I want the table rows to be able to scroll and leave the header row visible. So I created a one row table fro the header and a second row for the data rows. Now even though I have set the width on each column in both tables the same I am still getting the columns out of align especially when the data row table displays a scroll bar.
K West
Ranch Hand

Joined: Sep 10, 2008
Posts: 58

That is not the right way to do so. You may want to search google for Fixed header HTML tables. Or here is one JQuery plugin I have tried Scrollable Fixed Header Table

Years teach us more than books.
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15302

Seems like in another thread of yours (maybe it wasn't yours) I made this suggestion.

Create a thead section for your table as well as a tbody section. Make the tbody overflow: auto; and create an empty header column with a width of about 25px to account for the scroll bar.

GenRocket - Experts at Building Test Data
I agree. Here's the link:
subject: Align Two Tables Vertically
It's not a secret anymore!