We help IT Professionals succeed at work.

Fixed Report Headers using only page scrollbars

gdemaria
gdemaria asked
on
Medium Priority
1,193 Views
Last Modified: 2012-06-27
I'm not sure if this is possible, but it would be really great for me if it could be done..

I have a long table and I would like to get a fixed header at the top of it.  However, I really don't want to add a second scroll-bar (an in-page scroll bar) but rather just have the one main window scroll bar.

So, this is my idea...

I am wondering if when scrolling the page, if the page header can scroll away, but once the table header gets to the top of the page it would "stick" there.  While the rest of the table scrolls by..

------------------------------------------------------

PAGE HEADER   and  LOGO

------------------------------------------------------
Menu
------------------------------------------------------

..Page Title and some text content here..

--------------------------------------------------------------
Table Header (the thing I want fixed at the top)
--------------------------------------------------------------
Big
Long
Table
Data
...
...


In the example above, when the user scrolls the window's scroll bar, the page header, menu, and opening text would all scroll off the screen, but the table header would stick at the top of the page while scrolling continues to show the rest of the table data..

If that's not possible, how would you best handle this?   I tried paging, but the client really prefers a lot of data on the page, so fixed headers is desirable.

Thanks!

Comment
Watch Question

Can always used frames to anchor the header at the top and have the scrollbar attached to the content...

You can use Javascript to try and position the headers at the top of the current scroll position with absolute positioning and z-index....

I don't know of a CSS solution be interesting if someone else does.
CERTIFIED EXPERT

Author

Commented:
Thanks for your response.

> Can always used frames to anchor the header at the top and have the scrollbar attached to the content

Here is an example of just placing a div as a fixed header
http://limpid.nl/lab/css/fixed/header
I think I would do somethink like that over frames.  But my intent was to try and allow the upper part of the page to scroll as I don't want to waste the space for the page header always being there taking up space when scrolling.

> You can use Javascript to try and position the headers at the top of the current scroll position with absolute positioning and z-index....

That's an interesting idea to lock only the table header into position.  The table data would appear above it when scrolling and may look a bit odd, but its an interesting idea.

CERTIFIED EXPERT

Author

Commented:
thanks for your input!  Guess this isn't doable

Explore More ContentExplore courses, solutions, and other research materials related to this topic.