I think this is what you are trying to do is to use CSS transforms
property with the value translate
.
#your-div-id {
-ms-transform: translate(-50%, 50%); /* IE 9 */
-webkit-transform: translate(-50%, 50%); /* Safari */
transform: translate(-50%, 50%);
}
The value -50%
controls X-axis, and 50%
is for the Y-axis
PS: play around the values to get what you want
check this link for more details
solved Moving An Absolute Position Element Based Off Of Its Center