Center a 'div' in the middle of the screen, even when the page is scrolled up or down?

Solution 1:

Change the position attribute to fixed instead of absolute.

Solution 2:

Change position:absolute; to position:fixed;

Solution 3:

Quote: I would like to know how to display the div in the middle of the screen, whether user has scrolled up/down.

Change

position: absolute;

To

position: fixed;

W3C specifications for position: absolute and for position: fixed.