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.
1 2 3 4 5 6 7 8 9 |
.centered { position: fixed; top: 50%; left: 50%; margin-top: -50px; margin-left: -100px; } |