We help IT Professionals succeed at work.

HTML Table: Fixed column and row header - column offset using <center>

intellias_net
on
16,224 Views
Last Modified: 2011-02-14
In a table there are column header and row headers.   The first row displayed in the table should be fixed that is when you scroll the table vertically the top row remains at the top.   The first column also needs to be fixed; that is, when you scroll horizontaly the first column remains at the far left potiion.

Using multiple table solution supplied :
http://www.cubido.at/Portals/7/docs/Blog/Karin/HTML%20and%20Javascript/ResizeColumns/Table.htm

This sample fails to align the column headers correctly (offset by 1/2 the scrollbar width) when I use <center> to center the table (and any other elements i desire to have on the form).
e.g. by encasing the sample in the following form
<form>
<center>

               <h1>Fixed Headers (resize window to view scrollbars)</h1>
               <table border=0 cellspacing=0 cellpadding=0 width=80% >
               <tr><td>
............... sample coding of scrollable table
              </td></tr>
              </table>
</center>
</form>    



Comment
Watch Question

Jason WatkinsIT Project Leader

Commented:
Why not use a CSS, instead of fixed formatting?

http://www.htmlcenter.com/tutorials/tutorials.cfm/61/css/2/

/F
CERTIFIED EXPERT
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
The issue was adding fixed by:
<td  align="left">  <--- added alignment
<div class="headerRow">
Also making sure that alignment of the text was consistant from column headers and table body.
                  

Author

Commented:
P.S. Ohter solutions using CSS fo fix headers are convient; however, select elements will not respond to z order and will overlay the fixed headers.  Additionally the calculations of fixed headers using CSS expression has a nast habbit of locking up CPU time in certain situation causing the calculation of offsetWidth/Heights to take extrordinary time.

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.