moving image along with the scroll inside a TD or DIV

Problem

I have a table of height > 1000. It has Prev and Next buttons on the first and last TDs respectively. I want the Prev and Next button to be positioned in the middle with respect to the screen. I do not want to use JQuery.

TABLE -
_________________________________________
|        |                     |        |
|  TD1   |         TD2         |  TD3   |
|        |                     |        |
|        |                     |        |
|--------|---------------------|--------|-----------------------------
|        |                     |        |             _
|        |                     |        |             |
|        |                     |        |             |
|        |                     |        |             |
|   ##   |                     |   ##   |      Screen view now
|        |                     |        |             |
|        |                     |        |             |
|        |                     |        |             |
|        |                     |        |             _
|--------|---------------------|--------|-----------------------------
|        |                     |        |
|        |                     |        |
|        |                     |        |
|        |                     |        |
-----------------------------------------

Legend : ## - Button
Problem courtesy of: Anirudh

Solution

Set style for button elements:

.button {
    position: fixed;
    top: 50%;
}

Although buttons won't be exactly in the middle (plus half of height), should look ok

Solution courtesy of: wachme

Discussion

try using CSS. give each of your buttons a class and adjust their margins. Example:

HTML

<div class="btnNext"> button info goes here </div>
<div class="btnPrev"> button info goes here </div>

CSS

.btnNext
{
    margin-left: auto;
    margin-right: auto;
    position: fixed;
bottom: 0px;
}

.btnPrev
{
    margin-left: auto;
    margin-right: auto;
    position: fixed;
    bottom: 0px;
}
Discussion courtesy of: user2433662

This recipe can be found in it's original form on Stack Over Flow.