Just change the values of the margins depending on how big the item is, i.e a modal window.
Then it will always stay 50% on the middle, minus your settings.
.centered {
position: fixed;
top: 50%;
left: 50%;
margin-top: -50px;
margin-left: -100px;
}











