CSS Vertically & Horizontally Center Div [duplicate]

I have a pop up which contains an ASP.NET form, click the link "Request Information" and the form appears.

However, the pages that have the link "Request Information" to trigger the pop up have a lot of content therefore scrolling is required to see the link.

I need to have the div always centered if a user scrolls to read the content, otherwise if they don't scroll the pop up still appears centered on screen.

The div is positioned absolutely, the whole page width is 960px with margin set to 0 auto.


If the div has an fixed width and height use: (if width=120px and height=80px)

position: fixed;
top: 50%;
left: 50%;
margin-left: -60px; /* negative half of the width */
margin-top: -40px; /* negative half of the height */