Rickard, that is an unfortunate not well implemented feature of CSS, it should work with position: fixed, but I still have to see that work somewhere.
If you find out how, please let me know, I am also strongly interested in that. Never managed to do it solely with css, but would certainly be neater.
fixed
The box's position is calculated according to the 'absolute' model, but in addition, the box is fixed with respect to some reference. In the case of continuous media, the box is fixed with respect to the viewport (and doesn't move when scrolled). In the case of paged media, the box is fixed with respect to the page, even if that page is seen through a viewport (in the case of a print-preview, for example). Authors may wish to specify 'fixed' in a media-dependent way. For instance, an author may want a box to remain at the top of the viewport on the screen, but not at the top of each printed page. The two specifications may be separated by using an @media rule, as in:
Example(s):
@media screen {
H1#first { position: fixed }
}
@media print {
H1#first { position: static }
}